Giter Club home page Giter Club logo

scryfall-swiftui's Introduction

Yet another Scryfall frontend for iOS

This is a simple SwiftUI app for iOS to search cards on Scryfall database. It is being written as a hobby project for learning SwiftUI and is not aimed to be commercialized in any form. The code is free for use.

Features

  • Standard Scryfall search, with the same query language.
  • Different presentation and sort options, closely mimicing the main site.
  • Cross-links from card page back to the search (for Set, Artist, Prinings, etc.)
  • Basic cache implementation for images and API calls.
  • Adaptive layout for phones and pads.

Issues

  1. The main one is that SVGKit I use for parsing set symbols is failing to parse some of the SVG data. I patched it locally to avoid that, but haven't yet pushed the change to the main reposotory. If you want to fix it in your builds, here's the diff you'll need:
diff --git a/Source/Parsers/SVGKPointsAndPathsParser.m b/Source/Parsers/SVGKPointsAndPathsParser.m
index f19da1c..f7fb597 100644
--- a/Source/Parsers/SVGKPointsAndPathsParser.m
+++ b/Source/Parsers/SVGKPointsAndPathsParser.m
@@ -314,6 +313,28 @@ static inline CGPoint SVGCurveReflectedControlPoint(SVGCurve prevCurve)
     return p;
 }
 
++ (CGPoint) readArcFlags:(NSScanner*)scanner
+{
+    CGPoint p;
+    [SVGKPointsAndPathsParser readFlag: scanner intoFloat: &p.x];
+    [SVGKPointsAndPathsParser readFlag: scanner intoFloat: &p.y];
+    return p;
+}
+
++ (void) readFlag:(NSScanner*)scanner intoFloat:(CGFloat*) floatPointer
+{
+    NSUInteger location = [scanner scanLocation];
+
+    // Skip spaces. For some reason readWhitespace doesn't advance scanLocation.
+    while ([scanner.string characterAtIndex: location] == ' ') {
+        location += 1;
+    }
+
+    // Read flag.
+    *floatPointer = ([scanner.string characterAtIndex: location] == '0') ? 0 : 1;
+    [scanner setScanLocation:location + 1];
+}
+
 + (void) readCoordinate:(NSScanner*)scanner intoFloat:(CGFloat*) floatPointer
 {
 #if CGFLOAT_IS_DOUBLE
@@ -832,7 +853,7 @@ static inline CGPoint SVGCurveReflectedControlPoint(SVGCurve prevCurve)
     
     [SVGKPointsAndPathsParser readCommaAndWhitespace:scanner];
  
- CGPoint flags = [SVGKPointsAndPathsParser readCoordinatePair:scanner];
+ CGPoint flags = [SVGKPointsAndPathsParser readArcFlags:scanner];
  
  BOOL largeArcFlag = flags.x != 0.;
  BOOL sweepFlag = flags.y != 0.;

  1. API search is not 1:1 mapped to the site's search, which is stated in API documentation. Some features are not available, some features I tried to map as closely as I could to the site's behavior. Still, you might get different results when doing a search through the site compared to this app.

Requirements

iOS 14.3 and XCode 12.3 or newer.

Deps

  • SVGKit

License

MIT

scryfall-swiftui's People

Contributors

cog1to avatar

Stargazers

Blaz Smolnikar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.