Mobile SDK's (beta)

Integrate Connect seamlessly into iOS and Android apps

Context

Our Connect product supports native mobile SDKs, enabling developers to launch the Connect suite of products directly into their iOS and Android applications with minimal effort. This addition brings faster integration, improved performance, and a more seamless user experience compared to traditional mobile-web or API-only implementations.

iOS

Requirements

  • iOS 13.0+
  • Swift 5.0+
  • Xcode 13.0+

Installation via Swift Package Manager

Add the following to your Package.swift:

dependencies: [  
  .package(url: URL_TO_BE_DECIDED, from: "1.0.0")  
]

Integration

Follow the following steps:

  1. Create a View in your application that will trigger the Auth flow
  2. Import the SDK
  3. When clicking a button or other UI element, start the flow:
    1. Get a JWT from a backend API
    2. Configure the SDK appearance, environment and callbacks you want to use.
      1. Callbacks will return the same data described here
    3. Use the present method sending the View to render the SDK.

Example

import SwiftUI
import ConnectSDK // 1. Import the SDK main class

struct ContentView: View {
   // 2. Attach start function with a button or other UI element.
    var body: some View {
        Button("Deposit with crypto") {
            startConnect()
        }
    }

    func startConnect() {
        // 3. Get a JWT from your backend
        let jwt = getJWT()
        
        // 4. Configure the session
        let session = ConnectSDK.configureAuth(
            jwt: jwt, // JWT returned by backend, REQUIRED.
            environment: .sandbox, // Environment you want to use (OPTIONAL, defaults to .production)
            theme: .dark, // Appearance. Options: .light, .dark and .system (OPTIONAL, defaults to .system)
            callbacks: AuthCallbacks( // Listen for events. OPTIONAL. 
                onClose: { print("Closed") },
                onError: { error in print("Error: \(error.message)") },
                onDeposit: { deposit in print("Deposit: \(deposit.success ? "successful" : "failed")") }
            )
        )

        // 4. Present the SDK by calling the .present method with the ViewController you want to use.
        if let rootVC = UIApplication.shared.windows.first?.rootViewController {
            session.present(from: rootVC)
        }
    }

    func getJWT() -> String {
        // Make a backend call to retrieve the JWT.
        return "jwt-token"
    }
}