Get Started with iOS
Reference for the Magic SDK for iOS: https://github.com/magiclabs/magic-ios-pod
Overview
The Magic SDK for iOS is your entry-point to secure, passwordless authentication for your mobile app. This guide will cover some important topics for getting started with iOS APIs and to make the most of Magic's features.
Magic can support either server-based or serverless web applications. It is up to the developers to implement the Admin SDK to validate the DID Token.
- View the API documentation below to learn the methods you'll be using
Installation
It's easy to install Magic SDK if you manage your iOS dependencies using CocoaPods. If you don't have an existing Podfile, run the following command to create one:
Add pod 'MagicSDK'
to your Podfile
:
Run the following command:
To update pods to the latest:
Create an SDK Instance
All the examples are written in Swift. Objective-C examples will be added soon.
Returns via PromiseKit
Magic offers functions that returns promisified results by using PromiseKit. For more detail about promiseKit in iOS, please check PromiseKit.
So this...
...is equivalent to the follow function call:
Once the authentication request is complete, the closure will be executed with either success or failure state in the result. If you choose to return as a promise, the promise will resolve with success state or reject when failure state is reached.