DEV Community

Cover image for Day 18: Swift macOS password manager for people who hate the cloud
Sean Walker
Sean Walker

Posted on

Day 18: Swift macOS password manager for people who hate the cloud

<- For Day 17 go here

πŸ“… 01/18/2019
πŸš€ 12 days until launch
πŸ”₯ 17 day streak
πŸ’° $2.99 price (into cup of coffee territory now)
πŸ€‘ $0 revenue
πŸ“ˆ 0 customers
⌚️ 23 hours spent
πŸ’» 78 files changed, 246992 insertions(+), 54 deletions(-) (insertions are including 3rd party code 😬)
🏁 Today's goal: Touch ID support

5:05 PM
I keep racking up the hours on this thing!

5:30 PM
TouchID is surprisingly easy to do… here's the code

    import LocalAuthentication

    func showTouchID() {
        let context = LAContext()
        context.localizedCancelTitle = "Cancel"
        context.localizedFallbackTitle = "Unlock with password"

        var error: NSError?
        if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
            let reason = "unlock AllYourPasswords"

            context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason ) { success, error in

                if success {
                    // Move to the main thread because a state update triggers UI changes.
                    DispatchQueue.main.async { [unowned self] in
                        self.showPasswords()
                    }

                } else {
                    print(error?.localizedDescription ?? "Failed to authenticate")
                }
            }
        }
    }
Enter fullscreen mode Exit fullscreen mode

I'll probably do something else tonight because that was only 20 minutes… here's what it looks like:

I'll be back πŸ•Ά

Turns out I had a life tonight! What! See you tomorrow πŸ‘‰

Top comments (0)