Skip to main content

iOS quick start

This guide gets a working biometric capture on screen with the Mobai-provided user interface. The example uses V3 constraints, shows production feedback, and returns a video with three sampled frames by default.

Requirements​

  • Xcode 15 or later
  • iOS 15.0 or later
  • A physical device for production-quality camera testing

1. Install the SDK​

Version 2.3.3 is available as mob.MobaiBiometric in Mobai's private Cloudsmith Swift registry. Follow Install on iOS to configure the registry, store your read-only access token, and add the package to a Swift package or Xcode app. If you use the local Xcode wrapper shown there, import MobaiBiometricCloudsmith in the code below.

2. Add camera permission​

Add NSCameraUsageDescription to the application’s Info.plist:

<key>NSCameraUsageDescription</key>
<string>We use the camera to capture your face for identity verification.</string>

3. Present the capture UI​

import UIKit
import MobaiBiometric

final class IdentityViewController: UIViewController, MBCaptureSessionVCDelegate {
func startBiometricCapture() {
let options = MBCaptureSessionOptions(
numberOfFrameToCollect: 3,
videoCaptureDuration: 2_000,
captureConstraints: .v3,
imageQualityLevel: .level2
)

let style = MBUIOptions(
showProgressBar: true,
showFaceStatusLabel: true,
showCountdownTimerLabel: true
)

let captureController = MBCaptureSessionViewController(
with: options,
style: style
)
captureController.delegate = self
present(captureController, animated: true)
}

func onSuccess(result: MBCaptureSessionResult) {
let video = result.capturedVideoData
let frames = result.padData
let faceImage = result.faceImage

// Continue with your upload or verification flow.
dismiss(animated: true)
}

func onFailure(error: MBCaptureSessionError) {
// Show an error and let the user retry.
}

func onStateChanged(stateEnum: MBCaptureState) { }

func onPresentedDismissTapped() {
dismiss(animated: true)
}
}
Production feedback

isDebugging can remain false. showProgressBar and showFaceStatusLabel make progress and live V3 guidance visible in production.

4. Test the capture​

Run the application on an iPhone, grant camera access, and keep one face inside the overlay. V3 requires valid face distance, position, pose, and lighting before capture starts.

Next steps​