The best way to use the Zora API in your Swift projects.

Overview

ZoraKit

The best way to use the Zora API in your Swift projects.

Disclaimer

This is still very much a work in progress, and is really a proof-of-concept as part of the first Zora API Hackathon. We're still thinking through what components are helpful and which parts of the API to surface more naturally, so this repo will feel very in flux as we experiment in the open.

We have an immediate need for this kind of package, so we'll be working through it and quickly getting to a 0.1 so we can all iterate on it together.

Why?

The Zora API https://api.zora.co is an extremely powerful NFT API that provides metadata, sales, mints, market data, media, and more.

While you can totally bring in something like Apollo and just make GraphQL queries yourself, there's a bit of ceremony to set that up.

The ZDK and Zora's other NFT Components make it extremely easy to use the Zora API in your web or React-based projects, but those tools don't exist on native platforms like iOS. Yet.

With ZoraKit, you can use the Zora API in your Swift and SwiftUI projects in a way that feels more native to the platform.

Using it

Add this git repo as a swift package in Xcode. It's not published yet, so just set it to target main to stay on the cutting edge.

Import ZoraAPI if you just want to make API calls. We're scoping out helpers and abstractions to make it friendlier, but you also can also build your own calls directly with Apollo.

  • ZoraAPI.shared: A ready to use instance of the Zora API.
    • .token(address, id): Returns an NFT and its metadata.
    • .tokens(search): Returns a list of NFTs based on your query parameters.
      • search:
        • .owner(address or ENS): List all NFTs owned by an address
        • `.collectionAddress(address): List all NFTs in a collection
        • more soon
    • perform(query): Perform your own custom GraphQL query via Apollo. Useful if you need something while we're building more abstractions.
  • NFTCollectionLoader: A prebuilt collection loader perfect for use in a View Model or in your SwiftUI views
  • NFTLoader: Same as above, but for individual tokens.

Import ZoraUI to use some of our built-in SwiftUI views.

  • NFTCard: A basic display of an NFT. Useful for a grid.
  • NFTImage: Automatically loads and displays images from a token.
    • SVG and other multimedia support is a WIP.

How easy is it to make something useful? Display a grid of your own NFTs:

struct ContentView: View {
  @StateObject var collection = NFTCollectionLoader(.owner("leeadkins.eth"))
  var body: some View {
    ScrollView {
      LazyVGrid(columns: [GridItem(), GridItem()]) {
        ForEach(collection.tokens) { token in
          NavigationLink(value: token) {
            NFTCard(token)
          }
        }
      }.padding(20)
    }
  }
}

We're currently working on better loader options and additional building blocks.

Running the example

  • Open the ZoraKit.xcworkspace.
  • Select the ExampleApp scheme.
  • Run the example app.

Regenerating the Schema

We used the standard Apollo Codegen to generate Schema.swift, but we did have to enable passthroughCustomScalars for metadata decoding.

(documentation and helpers coming soon)

What's next

  • Polish the ZoraAPI callsites, normalize a lot of the data model.
  • More helpers to build your own API calls and aggregations.
  • More helpers to build UIKit and SwiftUI apps with ZoraUI
  • More built-in components for common NFT tasks.
  • Actual SVG support.
  • More support for Zora NFTs and the assorted content
You might also like...
Instagram API client written in Swift
Instagram API client written in Swift

SwiftInstagram is a wrapper for the Instagram API written in Swift. It allows you to authenticate users and request data from Instagram effortlessly.

A Slack API Client for the Perfect Server-Side Swift Framework

PerfectSlackAPIClient is an API Client to access the Slack API from your Perfect Server Side Swift application. It is build on top of PerfectAPIClient

A Swift library for the Forecast.io Dark Sky API
A Swift library for the Forecast.io Dark Sky API

Requirements To use ForecastIO, all you need is an API key for the Dark Sky API. ForecastIO supports iOS (≥9.0), macOS (≥10.10), watchOS (≥2.0), and t

Questrade API written in Swift.

QuestradeAPI Getting Started The QuestAPI is made up of two main concepts: ResponseProviders API ResponseProviders The job of the provider is to retur

Endless-Api-OP - A swift server for Endless
Endless-Api-OP - A swift server for Endless

Endless-Api Introduce Hear is endless-api open source library. Endless-Api is us

The Easiest and Simplest iOS library for Twitter and Facebook. Just Drop in and Use!
The Easiest and Simplest iOS library for Twitter and Facebook. Just Drop in and Use!

EasySocial iOS Library for Twitter and Facebook This library allows your apps to use Twitter and Facebook with minimal understanding of the relevant S

A stable, mature and comprehensive Objective-C library for Twitter REST API 1.1
A stable, mature and comprehensive Objective-C library for Twitter REST API 1.1

STTwitter A stable, mature and comprehensive Objective-C library for Twitter REST API 1.1 Like a FOSS version of Twitter Fabric TwitterKit, without th

Twitter API for Cocoa developers

FHSTwitterEngine Twitter API for Cocoa developers Created by Nathaniel Symer FHSTwitterEngine can: Authenticate using OAuth and/or xAuth. Make a reque

Giphy API client for iOS in Objective-C

Giphy-iOS Giphy-iOS is a Giphy API client for iOS in Objective-C. Usage To run the example project, clone the repo, and run pod install from the Examp

Owner
MBLA
We've been building products together for the last 10+ years. We're passionate about technology & making things people enjoy.
MBLA
An easy-to-use Objective-C wrapper for the Uber API (no longer supported)

UberKit UberKit is a simple Objective-C wrapper for the new Uber API . Installation Cocoapods UberKit is available through Cocoapods. To install it, s

Sachin Kesiraju 95 Jun 30, 2022
A clima based app with use of API

Clima Our Goal It’s time to take our app development skills to the next level. We’re going to introduce you to the wonderful world of Application Prog

null 0 Nov 28, 2021
The Swift-est way to build native mobile apps that connect to Salesforce.

Swiftly Salesforce is the Swift-est way to build native mobile apps that connect to Salesforce: Written entirely in Swift. Very easy to install and up

Michael Epstein 131 Nov 23, 2022
Wanikani-swift - Unofficial Swift client for the WaniKani API

WaniKani A Swift library and client for the WaniKani REST API. It currently supp

Aaron Sky 5 Oct 28, 2022
SwiftCloudDrive - An easy to use Swift wrapper around iCloud Drive.

SwiftCloudDrive Author: Drew McCormack (@drewmccormack) An easy to use Swift wrapper around iCloud Drive. SwiftCloudDrive handles complexities like fi

Drew McCormack 11 Dec 21, 2022
A Swift wrapper for Foursquare API. iOS and OSX.

Das Quadrat Das Quadrat is Foursquare API wrapper written in Swift. Features Supports iOS and OSX. Covers all API endpoints. Authorization process imp

Constantine Fry 171 Jun 18, 2022
Unofficial GitHub API client in Swift

Github.swift ❤️ Support my apps ❤️ Push Hero - pure Swift native macOS application to test push notifications PastePal - Pasteboard, note and shortcut

Khoa 184 Nov 25, 2022
A swift SDK for Medium's OAuth2 API

Medium SDK - Swift A library to allow access to Medium API for any Swift iOS application. Features Medium.com authorization & token handling Login sta

null 11 Jan 22, 2022
An Elegant Spotify Web API Library Written in Swift for iOS and macOS

Written in Swift 4.2 Spartan is a lightweight, elegant, and easy to use Spotify Web API wrapper library for iOS and macOS written in Swift 3. Under th

Dalton Hinterscher 107 Nov 8, 2022
Swift Wrapper For Bittrex API

BittrexApiKit Swift client for Bittrex api. It support all APIs with most recent changes. more info here let api = Bittrex(apikey: "api key", secretke

Saeid 8 Apr 5, 2021