Step 2: Session Initialization

To initialize the Suki Ambient SDK in your iOS application, follow these steps:

1. Import the Framework

import SukiAmbientCore

2. Set the SDK Environment

Set the environment using the SukiAmbientCoreManager.shared.environment property. The recommended environments for clients are STAGE and PROD.

3. Initialize the SDK

Call the initialization method after user login, or in your application delegate’s didFinishLaunchingWithOptions if login sessions persist across launches:

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)
    }
}

Key Notes

  • Partner Info:
    The partnerInfo dictionary should include the partner ID and provider details. Currently, these parameters are not actively used, as the SDK is designed for a single user with one specialty. The initialization signature may change in future releases.
  • Completion Handler:
    The completion block is invoked with the result of the initialization, whether successful or failed.
  • Delegates:
    Optionally, set a delegate to receive recording-level event callbacks.
  • Error Handling:
    The initialization method may throw a SukiAmbientCoreError if an error occurs.
  • Token Provider:
    The SDK requires a token provider object conforming to the TokenProvider protocol. The client application is responsible for supplying a valid token whenever requested by the SDK.
  • Background Recording:
    Pass true for background recording support if your app allows it. If set to true, the SDK will continue recording when the app is backgrounded; otherwise, recording will pause and must be resumed when the app returns to the foreground.