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
Github links
Requirements
- iOS 13.0+
- Swift 5.0+
- Xcode 13.0+
Installation via Xcode
-
In Xcode, select File > Add Package Dependencies...

-
Enter the repository URL:
https://github.com/connect-by-zerohash/connect-ios -
Select the version rule you want to use (we recommend
Up to Next Major Version)
-
Click Add Package
-
On the next popup, select your app target and click on
Add Package
-
Confirm that the ConnectSDK is now listed on your app's package dependencies:

-
Go to your application target and make sure that ConnectSDK is listed under
Frameworks, Libraries and Embedded Content
Integration
Follow the following steps:
- Create a View in your application that will trigger the Auth flow
- Import the SDK
- When clicking a button or other UI element, start the flow:
- Get a JWT from a backend API
- Configure the SDK appearance, environment and callbacks you want to use.
- Callbacks will return the same data described here
- Use the present method sending the View to render the SDK.
Example
Also represented in our code recipe here.
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"
}
}
Updated 12 days ago
