divadretlaw / Passcode

đŸ”‘Â Passcode View to lock iOS apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Passcode Platforms Carthage Swift License

Usage

let window = ... // Window to display this on e.g. AppDelegate Window

// Config
let config = PasscodeConfig(passcodeGetter: {
            // Return code as string
        }, passcodeSetter: { code in
            // Save new code
        }, biometricsGetter: {
            // return Should use biometrics (Touch ID or Face ID) as Bool
        })

// window can be nil if you only use it on UIViewControllers
let passcode = Passcode(window: self.window, config: config)

Asks for Authentication over current window

passcode.authenticateWindow()

Asks for authentication on ViewController

passcode.authenticate(on: viewController, animated: true)

Asks for code on ViewController

passcode.askCode(on: viewController, animated: true)

Asks changes code on ViewController

passcode.changeCode(on: viewController, animated: true)

All functions have completions if authentication or code change was successful e.g.

passcode.askCode(on: viewController, animated: true) { success in
	print("Code was entered correctly? \(success)"
}

For an example implementation see the Example app.

The default passcode is 1234

Installation

Passcode is available through Carthage. To install just write into your Cartfile:

github "divadretlaw/Passcode"

License

See LICENSE

Copyright © 2018 David Walter (www.davidwalter.at)

About

đŸ”‘Â Passcode View to lock iOS apps

License:Apache License 2.0


Languages

Language:Swift 97.7%Language:Objective-C 2.3%