Importing and Initializing

Import the Framework

Add the following line at the top of any Swift file where you want to use the SDK:

import Mpc

Initialize the SDK

Initialize the SDK in AppDelegate.swift or SceneDelegate.swift, depending on your project setup.

import UIKit
import Mpc

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Get the window from the first connected scene
        guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
              let window = windowScene.windows.first else {
            fatalError("No window found")
        }
        
        let passkey = PasskeyClientImpl(
            window: window,
            apiKey: "API_KEY",
            authServerAddress: "AUTH_SERVER_ADDRESS"
        )
        let client = MpcClient(
            "YOUR_SERVER_ADDRESS", 
            "YOUR_TOKEN",
            "YOUR_MODE",
            "AUTH_SERVER_ADDRESS",
            "MAIN_SERVER_ADDRESS",
            passkey
        )
        client.initClient()
    }
}

Last updated