Move isFaceIdSupported to Leadkit

This commit is contained in:
Aliona 2018-07-25 15:46:41 +03:00
parent b6c8200015
commit c27a031dcc
3 changed files with 15 additions and 1 deletions

View File

@ -1,6 +1,10 @@
# Changelog
### 0.3.4
- **Add**: `isFaceIdSupported` variable to `BiometricsService` to distinguish FaceID from TouchID.
### 0.3.3
- **Add**: Public `init` to `BiometricsService`

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LeadKitAdditions"
s.version = "0.3.3"
s.version = "0.3.4"
s.summary = "iOS framework with a bunch of tools for rapid development"
s.homepage = "https://github.com/TouchInstinct/LeadKitAdditions"
s.license = "Apache License, Version 2.0"

View File

@ -29,6 +29,16 @@ public final class BiometricsService {
private lazy var laContext = LAContext()
/// Returns true if user can authenticate via faceID
public var isFaceIdSupported: Bool {
if #available(iOS 11.0, *) {
return laContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
&& laContext.biometryType == .faceID
} else {
return false
}
}
/// Returns current domain state
public var evaluatedPolicyDomainState: Data? {
// We need to call canEvaluatePolicy function for evaluatedPolicyDomainState to be updated