Skip to content

Latest commit

 

History

History
executable file
·
65 lines (52 loc) · 2.24 KB

README.md

File metadata and controls

executable file
·
65 lines (52 loc) · 2.24 KB

BiometryAuthUI

This is a ready-to-use UI for working with touchID/faceID/pincode auth

Installation

pod 'BiometryAuthUI'

Usage

NOTE. The app's Info.plist must contain an NSFaceIDUsageDescription key with a string value explaining to the user how the app uses this data plist

Set passcode


// delete current passcode if needed
// let service = KeychainPasscodeService()
// service?.deletePasscode()

// BiometryUIModule will use your localization (see Example/BiometryExample.xcworkspace)
BiometryUIModule.shared().localizationTable = "Localization"

let vc = NewPasscodeViewController()
vc.tintColor = UIColor.red
vc.backgroundColor = UIColor.white
vc.passcodeCompletionBlock = {
    [weak self] in
    self?.dismiss(animated: true, completion: {
        [weak self] in
        let alert = UIAlertController(title: "Passcode created", message: nil, preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil))
        self?.present(alert, animated: true, completion: nil)
    })
}
self.present(vc, animated: true, completion: nil)

set passcode

Authorization

BiometryUIModule.shared().localizationTable = "Localization"
        
let vc = LoginViewController()
vc.tintColor = UIColor.white
vc.backgroundColor = UIColor.black
vc.shouldAskForBiometryOnDidAppear = true
vc.successCompletionBlock = {
    [weak self] in
    self?.dismiss(animated: true, completion: {
        self?.dismiss(animated: true, completion: {
            [weak self] in
            let alert = UIAlertController(title: "Success auth", message: nil, preferredStyle: .alert)
            alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil))
            self?.present(alert, animated: true, completion: nil)
        })
    })
}
self.present(vc, animated: true, completion: nil)

auth_faceid auth_passcode auth_touchid