Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FaceID_BiometryManager.swift
import LocalAuthentication
enum BiometryType {
case none, typeTouchID, typeFaceID
}
class BiometryManager {
var biometryType: BiometryType {
let context = LAContext()
var error = NSError?
guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
print(error?.localizedDescription ?? "")
return .none
}
if #available(iOS 11, *) {
switch context.biometryType {
case .none:
return .none
case .typeTouchID:
return .typeTouchID
case .typeFaceID:
return .typeFaceID
}
} else {
return .typeTouchID
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.