loading...
Cover image for Day 9: Making a swift macOS password manager for people who hate the cloud

Day 9: Making a swift macOS password manager for people who hate the cloud

swlkr profile image Sean Walker Originally published at streaking.app ・1 min read

Making a swift MacOS password manager for people who hate the cloud (32 Part Series)

1) Day 1: Making a swift macOS password manager for people who hate the cloud 2) Day 2: Making a swift macOS password manager for people who hate the cloud 3 ... 30 3) Day 3: Making a swift macOS password manager for people who hate the cloud 4) Day 4: Making a swift macOS password manager for people who hate the cloud 5) Day 5: Making a swift macOS password manager for people who hate the cloud 6) Day 6: Making a swift macOS password manager for people who hate the cloud 7) Day 7: Making a swift macOS password manager for people who hate the cloud 8) Day 8: Making a swift MacOS password manager for people who hate the cloud 9) Day 9: Making a swift macOS password manager for people who hate the cloud 10) Day 10: Making a swift macOS password manager for people who hate the cloud 11) Day 11: Making a swift macOS password manager for people who hate the cloud 12) Day 12: Swift macOS password manager for people who hate the cloud 13) Day 13: Swift macOS password manager for people who hate the cloud 14) Day 14: Swift macOS password manager for people who hate the cloud 15) Day 15: Swift macOS password manager for people who hate the cloud 16) Day 16: Swift macOS password manager for people who hate the cloud 17) Day 17: Swift macOS password manager for people who hate the cloud 18) Day 18: Swift macOS password manager for people who hate the cloud 19) Day 19: Swift macOS password manager for people who hate the cloud 20) Day 20: Swift macOS password manager for people who hate the cloud 21) Day 21: Swift macOS password manager for people who hate the cloud 22) Day 22: Swift macOS password manager for people who hate the cloud 23) Day 23: Swift macOS password manager for people who hate the cloud 24) Day 24: Swift macOS password manager for people who hate the cloud 25) Day 25: Swift macOS password manager for people who hate the cloud 26) Day 26: Swift macOS password manager for people who hate the cloud 27) Day 27: Swift macOS password manager for people who hate the cloud 28) Day 28: Swift macOS password manager for people who hate the cloud 29) Day 29: Swift macOS password manager for people who hate the cloud 30) Day 30: Swift macOS password manager for people who hate the cloud 31) Day 31: Swift macOS password manager for people who hate the cloud 32) How did my password manager do after launch?

<- For Day 8 go here

πŸ“… Jan 9th 2019
πŸš€ 21 days until launch
πŸ”₯ 9 day streak
πŸ€‘ 0 usd
πŸ“ˆ 0 customers
⌚️ 7.55 hours spent
πŸ’» 18 files changed, 987 insertions(+), 171 deletions(-)
🏁 Today's goals: Edit/delete existing passwords

11:35 PM

Definitely the most focused day since I only had 30 minutes before midnight, just going to get the delete working from the menu, definitely have to pick up the pace tomorrow though.

11:49 PM

I've done it, I've cracked the code. Luckily functional programming translates into most other languages pretty well, even the statically typed ones (I'm coming from clojure). What I needed to do was map the delete menu item to a function in AppDelegate.swift then do the old first responder trick and finally copy and paste that function definition to PasswordListViewController.swift.

From there it was just figuring out how to get multiple rows out of the array of Row objects and viola, sqlite.swift could take over with a .filter([].contains(id)). Here's how it looks in code

@IBAction func deleteLogin(_ sender: NSMenuItem) {
    do {
        let indices = tableView.selectedRowIndexes
        let ids = indices.compactMap { (logins?.count ?? -1 > $0) ? logins?[$0][login.id] : nil}
        let lg = login.table.filter(ids.contains(login.id))
        if try db.run(lg.delete()) > 0 {
            logins = Array(try! db.prepare(login.table))
            tableView.reloadData()
        } else {
            print("login not found")
        }
    } catch {
        print("delete failed: \(error)")
    }
}

⌚️ ~8 hours spent. Tomorrow will be a much more productive day. I'm sure of it

Making a swift MacOS password manager for people who hate the cloud (32 Part Series)

1) Day 1: Making a swift macOS password manager for people who hate the cloud 2) Day 2: Making a swift macOS password manager for people who hate the cloud 3 ... 30 3) Day 3: Making a swift macOS password manager for people who hate the cloud 4) Day 4: Making a swift macOS password manager for people who hate the cloud 5) Day 5: Making a swift macOS password manager for people who hate the cloud 6) Day 6: Making a swift macOS password manager for people who hate the cloud 7) Day 7: Making a swift macOS password manager for people who hate the cloud 8) Day 8: Making a swift MacOS password manager for people who hate the cloud 9) Day 9: Making a swift macOS password manager for people who hate the cloud 10) Day 10: Making a swift macOS password manager for people who hate the cloud 11) Day 11: Making a swift macOS password manager for people who hate the cloud 12) Day 12: Swift macOS password manager for people who hate the cloud 13) Day 13: Swift macOS password manager for people who hate the cloud 14) Day 14: Swift macOS password manager for people who hate the cloud 15) Day 15: Swift macOS password manager for people who hate the cloud 16) Day 16: Swift macOS password manager for people who hate the cloud 17) Day 17: Swift macOS password manager for people who hate the cloud 18) Day 18: Swift macOS password manager for people who hate the cloud 19) Day 19: Swift macOS password manager for people who hate the cloud 20) Day 20: Swift macOS password manager for people who hate the cloud 21) Day 21: Swift macOS password manager for people who hate the cloud 22) Day 22: Swift macOS password manager for people who hate the cloud 23) Day 23: Swift macOS password manager for people who hate the cloud 24) Day 24: Swift macOS password manager for people who hate the cloud 25) Day 25: Swift macOS password manager for people who hate the cloud 26) Day 26: Swift macOS password manager for people who hate the cloud 27) Day 27: Swift macOS password manager for people who hate the cloud 28) Day 28: Swift macOS password manager for people who hate the cloud 29) Day 29: Swift macOS password manager for people who hate the cloud 30) Day 30: Swift macOS password manager for people who hate the cloud 31) Day 31: Swift macOS password manager for people who hate the cloud 32) How did my password manager do after launch?

Posted on Jan 10 '19 by:

swlkr profile

Sean Walker

@swlkr

Takes hikes πŸ” Makes sites πŸ‘¨β€πŸ’»

Discussion

markdown guide