Skip to content

Instantly share code, notes, and snippets.

@r3ggi
Created November 25, 2019 13:43
Show Gist options
  • Save r3ggi/4eb247c54976e893c6a86d86f58e5a5e to your computer and use it in GitHub Desktop.
Save r3ggi/4eb247c54976e893c6a86d86f58e5a5e to your computer and use it in GitHub Desktop.
[Bypassing biometrics article] SecuBank verification example
@IBAction func startVerification(_ sender: Any) {
let myContext = LAContext()
let myLocalizedReasonString = "Verifying...."
var authError: NSError?
if myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) {
myContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: myLocalizedReasonString) { (success, evaluateError) in
DispatchQueue.main.async {
if success {
self.verificationStatusLabel.text = "✅ Verification successful"
} else {
self.verificationStatusLabel.text = "❌ Verification failed"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment