Skip to main content

Quick Setup

After following the install instructions you are ready to launch the SDK. The quick setup will go over how to launch the SDK using SwiftUI, but the UIKit implementation is identical, other than that it uses FaceCameraSDK.controller() instead of FaceCameraSDK.controllerSwiftUIWrapper.

Launching in SwiftUI

  1. Instantiate the controller and present it in SwiftUI:
extension HomeView {
var body: some View {
VStack(spacing: 20) {
}
.fullScreenCover(isPresented: $viewModel.showCamera) {
FaceCameraSDK.controllerSwiftUIWrapper(delegate: viewModel.delegateHandler)
}
}
}

To handle receiving the result and other events, you need to implement the following delegate methods:

class FaceCameraDelegateHandler: NSObject, FaceCameraListenable {
weak var parent: HomeViewModel?

init(parent: HomeViewModel) {
self.parent = parent
}

func didEncounterError(_ error: FaceCameraError) {
}

func didCapture(_ result: FaceCameraResult) {
}

func didCancel() {
}

func didTapBack() {
}
}

Note: Error Codes can be found here

Start the Camera

First check camera permissions and if not present obtain the camera permission. The camera will error if the camera permission is not present.

After ensuring that the camera permissions are present, present the viewcontroller, it will automatically start the capture process when loaded.