SDK Lifecycle
CafFaceLivenessDelegate
The CafFaceLivenessDelegate
protocol handles key events during the SDK's liveness detection process:
Event
Description
cancelled()
Triggered when the user cancels the process.
didFinishWithError(sdkFailure: CafSDKFailure)
Called on SDK failure, with error details provided in sdkFailure
.
loaded()
Triggered when the SDK is ready, if the loading screen is disabled.
loading()
Indicates the SDK is initializing, called if no loading screen is shown.
didFinishWithSuccess(livenessResult: CafLivenessResult)
Called upon successful detection, with the result in livenessResult.signedResponse
.
Example
extension YourViewController: CafFaceLivenessDelegate {
func didFinishWithSuccess(livenessResult: CafLivenessResult) {
print("Success: \(livenessResult.signedResponse ?? "No response")")
}
func cancelled() {
print("Liveness detection cancelled")
}
func didFinishWithError(sdkFailure: CafSDKFailure) {
print("Error: \(sdkFailure.description ?? "Unknown error")")
}
func loading() {
print("Liveness detection loading")
}
func loaded() {
print("Liveness detection loaded")
}
}
Last updated