Skip to content
This repository has been archived by the owner on Dec 26, 2020. It is now read-only.
/ Passcode Public archive

đŸ”‘Â Passcode View to lock iOS apps

License

Notifications You must be signed in to change notification settings

divadretlaw/Passcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)