Initialize and configure the SDK

At the top of your view controller import the PassioNutritionAISDK and AVFoundation

import PassioNutritionAISDK
import AVFoundation

Add the following properties to your view controller.

let passioSDK = PassioNutritionAI.shared
var videoLayer: AVCaptureVideoPreviewLayer?

In viewDidLoad configure the SDK with the Key you have received form Passio.

override func viewDidLoad() {
    super.viewDidLoad()
    let key = "Your_PassioSDK_Key"
    //* Use the API key you received from us or request a key from [support@passiolife.com](support@passiolife.com).
    let passioConfig = PassioConfiguration(key: key)
    passioSDK.configure(passioConfiguration: passioConfig) { (status) in
        print("Mode = \(status.mode)\nmissingfiles = \(String(describing: status.missingFiles))" )
    }
}

You will receive the PassioStatus back from the SDK.

public struct PassioStatus {
    public internal(set) var mode: PassioSDK.PassioMode { get }
    public internal(set) var missingFiles: [PassioSDK.FileName]? { get }
    public internal(set) var debugMessage: String? { get }
    public internal(set) var activeModels: Int? { get }
}

public enum PassioMode {
    case notReady
    case isBeingConfigured
    case isDownloadingModels
    case isReadyForDetection
    case failedToConfigure
}

If at any point you need help from the Passio team, please reach out to us at support@passiolife.com

Last updated