🔗 SharedKit
Biometric Auth (Face ID / Touch ID)
import SharedKit

SwiftyLaunch Version 1.2+

Perform Sensitive Operations using Biometric Authentication

Biometric Auth Thumbnail

To perform a Biometric Authentication, use the BiometricAuth class:

Option 1: by calling authenticateWithBiometric()

authenticate() is an async function, which conducts a biometric scan and returns true or false depending on the result.

if (await BiometricAuth.authenticate()) {
    print("😎")
}

Option 2: by using executeIfSuccessfulAuth()

A wrapper around the previous function. Pass your desired function as a closure, which will execute depending on the authentication result:

await BiometricAuth.executeIfSuccessfulAuth {
     print("We're in.")
}

Protect a View with Biometric Authentication

Just apply a .sensitiveView() modifier, and the View will require Biometric Authentication for its contents to be seen. Additionally the View will automatically be blurred when the user navigates away from the app (i.e. in the App Switcher).

sensitiveView Modifier Example