DEV Community

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

Posted on

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

<- For Day 15 go here

📅 01/16/2019
🚀 14 days until launch
🔥 15 day streak
💰 $2.99 price (into cup of coffee territory now)
🤑 $0 revenue
📈 0 customers
⌚️ 13.5 hours spent
💻 20 files changed, 1324 insertions(+), 171 deletions(-)
🏁 Today's goal: Copy buttons for username, email and password

6:00 AM
Decided to just be tired and see how much I could get done before work.

7:06 AM
Hey! Xcode crashed finally. Was trying to use gravity areas and a stack view and moving the last gravity area in storyboard caused Xcode to quit really quickly, not even so much as a beach ball 🏖

8:00 AM
Just messed around with stackviews for hours at this point. Still don't understand them. Time to abandon ship and come up with something else for when username or email is nil

8:10 AM
It's a beauty:

    override func viewDidLoad() {
        super.viewDidLoad()
        let loginTable = Login()
        let kc = KeychainSwift()

        nameOrUrlValue.stringValue = login?[loginTable.name] ?? login?[loginTable.url] ?? ""

        let username = login?[loginTable.username] ?? ""
        let email = login?[loginTable.email] ?? ""
        let password = kc.get(login?[loginTable.key] ?? "") ?? ""

        if username.count > 0 {
            label1.stringValue = "Username"
            value1.stringValue = username

            if email.count > 0 {
                label2.stringValue = "Email"
                value2.stringValue = email

                label3.stringValue = "Password"
                value3.stringValue = password
            } else {
                label2.stringValue = "Password"
                value2.stringValue = password
            }

        } else {
            label1.stringValue = "Email"
            value1.stringValue = email

            label2.stringValue = "Password"
            value2.stringValue = password
        }
    }
Enter fullscreen mode Exit fullscreen mode

You know you're doing something wrong when you have nested if/else statements. Shhh, don't tell anyone. It's our little secret. What's that saying? Move fast and break society? That doesn't sound right.

I didn't even manage to get the copy buttons in there, maybe I can squeeze it in after work.

7:00 PM
I'm here, I'm without beer, ready to rock and roll

7:27 PM
Done! 27 minutes and I did quite a few things, I decided to abandon the "view" view and just show the edit view when selecting things from the list, not sure if I like that yet, and behold, copy buttons:

Cool as a cucumber

See you tomorrow 👋

Top comments (1)

Collapse
 
niorad profile image
Antonio Radovcic

Very nice!