TrefleSwiftSDK

master

TrefleSwiftSDK is a Swift wrapper around the Trefle API.
Baza207/TrefleSwiftSDK

TrefleSwiftSDK

Swift Platforms SwiftPM Carthage CocoaPods Twitter

TrefleSwiftSDK is a Swift wrapper around the Trefle API.

This is currently a work in progress. There is a list of currently supported features listed below.

  • Authentication
  • Kingdoms
  • Subkingdoms
  • Divisions
  • Families
  • Genus
  • Plants
  • Species
  • Distribution Zones
  • Operation support
  • Combine support
  • Full error handling
  • Basic test suite
  • Deep test suite

Note: The current version of TrefleSwiftSDK is based on Trefle 1.6.0.

Prerequisites

Before you begin, ensure you have met the following requirements:

Installation

Swift Package Manager

To integrate TrefleSwiftSDK into your Xcode project using Swift Package Manager, add TrefleSwiftSDK as a dependency to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/Baza207/TrefleSwiftSDK.git", .upToNextMajor(from: "0.1.0"))
]

Carthage

To integrate TrefleSwiftSDK into your Xcode project using Carthage, specify it in your Cartfile with the following:

github "Baza207/TrefleSwiftSDK" "0.1.0"

CocoaPods

To integrate TrefleSwiftSDK into your Xcode project using CocoaPods, specify it in your Podfile with the following:

pod 'TrefleSwiftSDK', '~> 0.1.0'

Usage

Basic Setup

Once you have a access token from your Trefle Profile you will also need to create an URI in your Xcode project. To do this you can follow the steps to Register Your URL Scheme in the Apple documentation.

Once you have this, you can import the TrefleSwiftSDK framework in your project and set it up for use.

  1. Import TrefleSwiftSDK in your AppDelegate:
import TrefleSwiftSDK
  1. Setup TrefleSwiftSDK by calling configure(accessToken:uri:) in application(_:didFinishLaunchingWithOptions:), passing in your access token from your Trefle Profile as well as the URI you setup in Xcode Info tab.
Trefle.configure(accessToken: "<Access Token>", uri: "<Redirect URI>")
  1. You can then use all the fetch and search calls from any of the managers in the project. All the authentication is handled by the framework using the given access token, meaning you don't have to worry about logging in users or logging them out. All the JWT autnetication and re-authentication on expired tokens is done automatically.

Contributors

James Barrow

License

MIT Licence

Description

  • Swift Tools 5.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Jun 30 2022 01:25:58 GMT-0500 (GMT-05:00)