Skip to main content

Initialization

Embedding credentials

Implement the AcessoBioConfigDataSource protocol in your class:

UnicoConfig.swift
import AcessoBio

class YourUnicoConfigClass: AcessoBioConfigDataSource {
func getBundleIdentifier() -> String {
return "<YOUR_MOBILE_BUNDLE_IDENTIFIER>"
}

func getHostKey() -> String {
return "<YOUR_SDK_KEY>"
}
}
Instantiate the manager

Import the SDK and implement the AcessoBioManagerDelegate interface within the ViewController you want to use. Instantiate the builder, providing the context, and override the callback methods with the business logic of your application:

ViewController.swift
import UIKit
import AcessoBio

class ViewController: UIViewController, AcessoBioManagerDelegate {
var unicoCheck: AcessoBioManager!

override func viewDidLoad() {
super.viewDidLoad()
unicoCheck = AcessoBioManager(viewController: self)
}

func onErrorAcessoBioManager(_ error: ErrorBio!) { }
func onUserClosedCameraManually() { }
func onSystemClosedCameraTimeoutSession() { }
func onSystemChangedTypeCameraTimeoutFaceInference() { }
}
Mandatory delegate methods

All four delegate methods above must be created in your project (even without any logic). Otherwise, the project will not compile successfully.

Environment selection

The choice of environment is made during initialization. Use the EnvironmentEnum type:

  • EnvironmentEnum.PROD — production environment
  • EnvironmentEnum.UAT — UAT environment
unicoCheck.setEnvironment(.UAT)

For the full list of available environment types, refer to API Reference > Initialization API.

Lifecycle

SDK authentication with the backend takes a few seconds. Initialize early (cold start of the app), not when the user taps the capture button — otherwise the user experiences lag between the tap and the camera opening.