Day 8: Making a swift MacOS password manager for people who hate the cloud
Tags: passwordmanager, cloud, swift, macos
Published: 2019-01-09 05:19:32

📅 Jan 8th 2019
🚀 22 days until launch
🔥 8 Day Streak
🤑 $0 doll-hairs
⌚️ 6.5 hours
💻 17 files changed, 690 insertions(+), 171 deletions(-)
📈 0 customers
🏁 Today's goal: show the password details when selecting a row in the tableview

[<- Go here for Day 7](https://dev.to/swlkr/day-7-making-a-swift-macos-password-manager-for-people-who-hate-the-cloud-32bn)

Time moves faster when I have a daily routine. I start focusing more on completing my goals than on being bored and noticing things around me. It’s a huge trade off in the name of PROGRESS. I have noticed that dev.to is timezone hostile and shows random post dates (presumably UTC) even when I manage to hit the daily goal. Which is every day since Jan 1st. So I’m going to start putting the day and the date first.

### 8:45 AM
Read hacker news, make coffee, eat left over donuts from yesterday and think about the password manager. Luckily there is still quite a bit of low hanging fruit, *todays goals: show the password details when selecting a row in the tableview* But first, have to work a full day of work, since believe it or not, it's super hard to make money on the internet and much easier to work a full time job! Shocker, I know.

### 7:19 PM
Time to get started! First up, change the container view to a new view controller showing the name, url, email, username and password of the login.

### 8:02 PM
Done! Let's see this ux masterpiece
![](https://thepracticaldev.s3.amazonaws.com/i/p7arwj16uvjrnwm7m6s0.png)
￼
There she is in all her developer designed glory.

### 9:07 PM
I started to mess around with trying to get back to the list view/show view from the add view controller, but no luck so far. Going to take a break and play with my dog for a while, maybe install my nest thermostat.

### 9:19 PM
I'm back at it, but still no luck with the searching around. I must be doing something wrong to think that the container view can't be referenced from a child view.

### 9:45 PM
Took another break, but back at it again! Finally figured out how to change a view controller from within the container view!

```swift
        let query = login.table.order(login.id.desc)
        let row = try! db.pluck(query)

        let storyboard = NSStoryboard(name: NSStoryboard.Name("Main"), bundle: Bundle.main)
        let vc = storyboard.instantiateController(withIdentifier: "LoginViewController") as! LoginViewController
        vc.login = row

        let parentVC = self.parent as! PasswordListViewController

        parentVC.logins = Array(try! db.prepare(login.table))
        parentVC.tableView.reloadData()
        parentVC.tableView.selectRow(at: parentVC.logins?.count ?? 1 - 1)

        for sView in parentVC.containerView!.subviews {
            sView.removeFromSuperview()
        }

        addChild(vc)
        vc.view.frame = parentVC.containerView!.bounds
        parentVC.containerView!.addSubview(vc.view)
```
### 10:07 PM
Back at it again, this time I got distracted and was messing around with the "look and feel" of the app, although it doesn't have much to look at, I'll let you be the judge of how it looks and feels so far (you might have to give the gif a second to load)
￼![](https://thepracticaldev.s3.amazonaws.com/i/bvot281g0zn70pnraew9.gif)

And that's that, definitely quite a bit of work tonight, more than usual, of course it was mixed between watching netflix, playing with my dog and generally just living life, but I'll count the majority of tonight's hours towards the app.

⌚️7.55 hours. Tick tock.