Adding the SDK and initializing it

Nabla iOS SDK installation

⚠️

The Nabla iOS SDK is compatible with iOS 13 and higher.

Add the dependency

SPM

The recommended way to install our SDK is via Swift Package Manager.

Open your .xcodeproj, select the option "Add Package..." in the File menu, and paste this URL:

https://github.com/nabla/nabla-ios

Xcode will look for the Products available in the Package. Select NablaCore and the modules you want to activate (NablaMessagingUI, NablaVideoCall, NablaScheduling, etc.). Click "Add Package" and Xcode will download the dependencies.

Add package on Xcode

Go to your app's target and make sure that all Nabla modules have been added to Frameworks, Libraries and Embedded Content.

Added packages on Xcode

Cocoapods

Add the following dependency in your Podfile

pod 'NablaCore'

And also add the modules you want to use:

pod 'NablaMessagingUI'
pod 'NablaVideoCall'
pod 'NablaScheduling'

And then run pod install to update your project.

Initialize the SDK

Then, you need to initialize the SDK with the desired modules (e.g. NablaMessagingModule, NablaSchedulingModule, etc.). You will also need a mobile API key to initialize the SDK.

📘

To generate a mobile SDK API key, open your Nabla Console, go to the "Developers" tab, then to the "API keys" section, "Mobile SDK API keys" sub-tab, and click on "Add mobile SDK API key".

It is important to call NablaClient.initialize before accessing any method of the client. We recommend doing that when your app starts, in your application(_:didFinishLaunchingWithOptions:) method:

import NablaCore
import NablaMessagingCore // if you want the messaging feature
import NablaVideoCall // if you want to add video call capabilities
import NablaScheduling // if you want the scheduling feature

class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      NablaClient.initialize(
        configuration: .init(
            apiKey: "YOUR_API_KEY"
        ),
        modules: [
          NablaMessagingModule(), // if you want the messaging feature
          NablaVideoCallModule(), // if you want to add video call capabilities
          NablaSchedulingModule() // if you want the scheduling feature
        ],
        sessionTokenProvider: self
      )

      // ...

      return true
    }
}

extension AppDelegate: SessionTokenProvider {
    func provideTokens(forUserId userId: String, completion: @escaping (AuthTokens?) -> Void) {
        completion(nil)
    }
}

The NablaClient can then be accessed from anywhere with NablaClient.shared.