Face capture and liveness
Run a live selfie workflow and optionally compare it with the NFC portrait.
What users see
What your app receives. Face capture returns a selfie JPEG when available and separate liveness outcomes. Comparing the selfie with a passport chip portrait is a separate call that can return a similarity score.
Present the selfie flow
Enable camera permission and present this view. A nil result indicates cancellation. A capture result can report challenge progress without returning a JPEG.
Identomic.face(checksPassiveLiveness: true) { face in
guard let face else { return }
guard face.activeLivenessPassed, let jpeg = face.jpeg else {
// Offer retry or return to your app's capture screen.
return
}
// Use jpeg and inspect face.passiveLivenessPassed separately.
}Read the outcome
FaceCapture includes jpeg, completedChallenges, activeLivenessPassed and optional passiveLivenessPassed. Treat a missing passive result as unavailable and handle it according to your app’s policy.
Handle each outcome
- On cancellation, dismiss the capture flow.
- If the JPEG is missing or active liveness failed, allow retry or return to the previous step.
- Handle passive liveness independently. When a result is missing, use the unavailable state defined by your workflow.
Compare with the chip portrait
Use a completed FaceCapture and a PassportChip. The result exposes similarityPercent, meetsMatchThreshold, and failure. The score is a model similarity value, and the comparison can be inconclusive.
let comparison = await Identomic.compareFace(faceCapture, with: passportChip)
if let score = comparison.similarityPercent {
// Read score and comparison.meetsMatchThreshold.
} else {
// Handle comparison.failure and offer a retry when appropriate.
}
