Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Latest commit

 

History

History
33 lines (23 loc) · 1023 Bytes

constructor.md

File metadata and controls

33 lines (23 loc) · 1023 Bytes
description
Configure and construct your Magic SDK instance.

Constructor

Magic

Public constructors
Magic(apiKey: String) Construct a Magic instance with publishable API Key retrieved from the Magic Dashboard
Magic(apiKey: String, network: EthNetwork) Construct a Magic instance with publishable Key and Ethereum network
Magic(apiKey: String, customNode: CustomNodeConfiguration) Construct a Magic instance with publishable Key and Custom Node configuration

Example

In AppDelegate

import MagicSDK
import UIKit

@UIApplicationMain
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    // assign the newly created Magic instance to shared property
    // Test key defaults to "rinkeby", live key defaults to "mainnet"
    Magic.shared = Magic("YOUR_PUBLISHABLE_API_KEY");
    
    return true
}