Day 16: Swift macOS password manager for people who hate the cloud
Tags: macos, swift, passwordmanager, cloud
Published: 2019-01-17 02:38:05

---
title: Day 16: Swift macOS password manager for people who hate the cloud
published: true
description: Follow along as I make a 100% cloudless and 100% native password manager for macOS. That's 200% raw password managing power.
tags: macos, swift, password manager, cloud
series: Making a swift MacOS password manager for people who hate the cloud
cover_image: https://thepracticaldev.s3.amazonaws.com/i/q6r73zbfbm3mpfs98bu5.jpg
---

[<- For Day 15 go here](https://dev.to/swlkr/day-15-swift-macos-password-manager-for-people-who-hate-the-cloud-2e24)

📅 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:

```swift
    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
        }
    }
```

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:

![](https://thepracticaldev.s3.amazonaws.com/i/amn0m0qxrpu45h7f7qm1.gif)

Cool as a [cucumber](https://www.youtube.com/watch?v=lL42O2p1nx8)

See you tomorrow 👋