---
title: Initialization
canonical: https://developer.unico.io/dual-api/developers/sdks-and-tools/ios/initialization
locale: en
generated_by: markdown-export
---

## Embedding credentials

Implement the `AcessoBioConfigDataSource` protocol in your class:

### Swift

  ```swift title="UnicoConfig.swift"
  import AcessoBio

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

    func getHostKey() -> String {
      return "<YOUR_SDK_KEY>"
    }
  }
  ```

### Objective-C

  ```objectivec title="UnicoConfig.h / UnicoConfig.m"
  // .h
  #import <AcessoBio/AcessoBioManager.h>
  #import <AcessoBio/AcessoBio-Swift.h>

  @interface YourUnicoConfigClass : NSObject <AcessoBioConfigDataSource>
  @end

  // .m
  @implementation YourUnicoConfigClass

  - (NSString * _Nonnull)getBundleIdentifier {
      return @"<YOUR_MOBILE_BUNDLE_IDENTIFIER>";
  }

  - (NSString * _Nonnull)getHostKey {
      return @"<YOUR_SDK_KEY>";
  }

  @end
  ```

## 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:

### Swift

  ```swift title="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() { }
  }
  ```

### Objective-C

  ```objectivec title="ViewController.m"
  #import "ViewController.h"
  #import <AcessoBio/AcessoBio.h>

  @implementation ViewController: UIViewController
  - (void)viewDidLoad {
      [super viewDidLoad];
      unicoCheck = [[AcessoBioManager alloc]initWithViewController:self];
  }

  - (void)onErrorAcessoBioManager:(ErrorBio *)error { }
  - (void)onSystemChangedTypeCameraTimeoutFaceInference { }
  - (void)onSystemClosedCameraTimeoutSession { }
  - (void)onUserClosedCameraManually { }
  @end
  ```

:::danger[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

### Swift

  ```swift
  unicoCheck.setEnvironment(.UAT)
  ```

### Objective-C

  ```objectivec
  [unicoCheck setEnvironment:UAT];
  ```

For the full list of available environment types, refer to [API Reference > Initialization API](/developers/sdks-and-tools/ios/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.