Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

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)