A Swift SDK for the Scryfall API

What's New



What's Changed

New Contributors

Full Changelog: v5.9.0...v5.9.1


Build and test Swift Version Compatibility Platform Support

A Swift Package for accessing Scryfall's REST API


This library is largely a translation of Scryfall's REST API to a collection of Swift enums and structs. It is highly recommended that you read the official Scryfall API docs as the documentation in this project will not attempt to give in-depth explanations of how each of these endpoints work.

For the most up to date documentation, use the DocC pages published here

To generate these pages locally, use this command from Apple's Swift DocC plugin

swift package --disable-sandbox preview-documentation --target ScryfallKit

Getting Started

Add ScryfallKit to your project either through the Xcode UI, or through the process below for Swift Packages

let package = Package(
    // ... Other Package.swift stuff goes here
    dependencies: [
        .package(url: "", from: "5.0.0"), // Add the library to your manifest
    targets: [
        .target(name: "MyPackage", dependencies: ["ScryfallKit"]), // Add it to your target's dependencies


import ScryfallKit

let client = ScryfallClient()

// Retrieve the Strixhaven Mystical Archive printing of Doom Blade
do {
    let doomBlade = try await client.getCardByName(exact: "Doom Blade", set: "STA")
} catch {
    print("Received error: \(error)")

// Or using a completion handler
client.getCardByName(exact: "Doom Blade", set: "STA") { result in
    switch result {
    case .success(let doomBlade):
    case .failure(let error):
        print("Received error: \(error)")

Network Logging

The ScryfallClient has a configurable level of network logging with two options: minimal and verbose. Enabling verbose logging will print the HTTP body of each request and response. Minimal logging will log that a request was made (and the URL it's made to) as well as that a response was received.


Contributions are always welcome, simply fork this repo, make and test your changes, and then open a pull request. I will try and review it within a reasonable amount of time.


  • Swift Tools 5.9.0
View More Packages from this Author


Last updated: Wed May 15 2024 11:08:38 GMT-0900 (Hawaii-Aleutian Daylight Time)