Component - Biometric authentication (Face ID, Touch ID)
This component allows users to log in using their face or fingerprint. It uses the device's built-in biometric sensors to check identity quickly and securely.
This component allows users to log in using their face or fingerprint. It uses the device's built-in biometric sensors to check identity quickly and securely.
UIViewController ├── UIView (main view) │ ├── UILabel (instruction text) │ └── UIButton (Authenticate) └── UIAlertController (for error or success messages)
let context = LAContext()
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Access needed") { success, error in
if success {
print("Authentication succeeded")
} else {
print("Authentication failed")
}
}let context = LAContext()
var error: NSError?
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: error) {
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Login") { success, error in
if success {
print("Access granted")
}
}
}Pass the test and this pattern moves unknown