DEV Community

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

Posted on

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

<- For Day 25 go here

📅 01/26/2019
🚀 4 days until launch
🔥 25 day streak
💰 $0.99 price (going to put in app store which only allows .99 values sigh)
🤑 $0 revenue
📈 0 customers
⌚️ 38.5 hours spent
😭 1 Rewrite
💻 113 files changed, 249768 insertions(+), 561 deletions(-)
🏁 Today's goal: Attempt to set up a landing page, make view screen not suck

8:35 PM
Well, I lived life again today, so the streaming didn't work out. I think I'll try to make the details page better somehow, while listening to some Florida Georgia Line. Don't judge me I'm a code cowboy 🤠

8:51 PM
Moved the buttons below the text fields, I think it looks better

9:28 PM
Also added a show button to hide the NSSecureTextField and show an NSTextField to show the plaintext password value. Can you believe there's no way to show plaintext values in an secure text field. I suppose it makes sense, but it's a pain for this app since you have two controls stacked on top of each other. So many hacks. Hacks on hacks.

I noticed that the memory keeps increasing linearly every time I switch rows in the table view. Have to fix that right now! No delay!

9:55 PM
That's that. It's done. I FIXED THE LEAK like the great plumber that I am.

Here's how I did it. I moved the "detail view controller" that gets called on tableview select, to an instance variable instead of re-instantiating in the function every time:

class ContainerViewController : NSViewController {

    var row : Row?
    var tableViewController : TableViewController?
    var detailViewController: DetailViewController? // <— here it is!

Once that was done, I kept track of whether or not there was a value there and called removeFromParent

        if let oldViewController = detailViewController {
            oldViewController.view.removeFromSuperview()
            oldViewController.removeFromParent()
            detailViewController = nil
        }

So good to see the memory stay steady around 36 MB. That's it for today. I'll fix the other memory leak around Edit/Cancel tomorrow. Also the slowness around edit/cancel, feels like a web app it's so slow. 🤦‍♂️

Top comments (0)