Skip to main content

Overview

To use the Suki mobile SDK, you must configure it when your application starts. Follow these steps to initialize the SDK.

Configure The SDK

Follow these steps to configure the mobileSDK:
1

Import the Framework

In the Swift file where you will manage the SDK, import the framework:
import SukiAmbientCore
2

Set the SDK Environment

Set the SDK environment by assigning a value to the SukiAmbientCoreManager.shared.environment property. The recommended environments are .stage and .prod.
// Set the SDK environment (recommended: .stage or .prod)
SukiAmbientCoreManager.shared.environment = .stage
3

Initialize The SDK

Call the initialize method to configure the SDK. You should call this method after a user signs in, or in your application delegate’s didFinishLaunchingWithOptions method if sign-in sessions persist.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    do {
        let partnerInfo: [String: AnyHashable] = [
            SukiAmbientConstant.kPartnerId: "123",
            SukiAmbientConstant.kProviderInfo: [
                SukiAmbientConstant.kOrgId: "provider_org_id",
                SukiAmbientConstant.kName: "Abhishek Rai",
                SukiAmbientConstant.kId: "providerId",
                SukiAmbientConstant.kSpeciality: "FAMILY_MEDICINE"
            ]
        ]
        try SukiAmbientCore.shared.initialize(
            withPartnerInfo: partnerInfo,
            with: true, // Set to true if your app supports background recording
            onCompletion: { result in
                // Handle initialization result
            },
            withSessionDelegate: self,
            withTokenProvider: self
        )
    } catch {
        print(error)
    }
}

Initialization Parameters

The initialize method takes the following parameters:
partnerInfo
dictionary
A dictionary containing partner and provider details.
These parameters are not actively used in the current version, as the SDK is designed for a single user with one specialty. The method signature may change in a future release.
backgroundRecording
boolean
Set this to true if your app supports background recording. If true, recording continues when the app is in the background. Otherwise, recording pauses and you must resume it when the app returns to the foreground.
onCompletion
completionHandler
A completion handler that is called with the result of the initialization, indicating success or failure.
sessionDelegate
delegateObject
An optional delegate object to receive callbacks for recording-level events.
tokenProvider
TokenProvider
An object that conforms to the TokenProvider protocol. Your application (client application) is responsible for providing a valid token when the SDK requests one through this protocol.

Error Handling

The initialize method can throw a SukiAmbientCoreError. You should use a do-catch block, as shown in the example above, to handle any potential errors during initialization.

Next Steps

After you configure the SDK, proceed to our Ambient Guides to start using the mobile SDK features.