Rob Fahrni

Follow @fahrni on Micro.blog.

Work Note: Stream for Mac

I was able to make it to the coffee shop and work on Stream today. I’ve been revisiting how to construct a good AppKit cell view — NSCellView — that does exactly what I want. And I continue to fail.

I’ve tried using constructing a cell using a NIB. It didn’t work as I’d wanted it to and I could never get it right. I abandoned that attempt.

Next I tried doing it in code. I managed to get the same exact results. It didn’t resize properly. I abandoned it.

I decided I should do it in SwiftUI. It only took me an hour or so of tweaks to make it work exactly like I wanted! Yay! 🥳

Next I had to get the little blue read/unread indicator working. I tried a lot of stuff but I couldn’t make it work driving it from an AppKit view (more on this later.)

So, I decided to give AppKit another try. This time using NSGridView in code. I wasn’t able to get the results I was after. So, you guessed it, I abandoned the attempt.

I thought I’d be clever and let Claude do it for me because I’m so darned hung up on it working as an AppKit cell.

I gave Claude a description of what I wanted, pointed it at the working SwiftUI version, told it to use my coding style, and turned it loose. At first glance I was surprised. What it built worked exactly like my AppKit versions. The date wasn’t pinned to the right of the cell view and things didn’t flow properly as I resized the cell. These are the exact same issues my hand built versions had. 😳

I went back to Claude and explained what I wanted to change and why. It went to work and made some tweaks. I thought, this is it!

Nope. Not it. Still has the same issue. The code was tweaked but I got the exact same results. 😳

I was puzzled to say the least.

At that point I was ready to declare I was a completely incompetent developer, throw my computer in a lake, and go hide away in the woods somewhere until I died.

I decided that was a little extreme and decided I’d go back to the working SwiftUI version.

Now, how do I actually get the darned blue read/unread dot to update properly?

I poked around at how Combine and SwiftUI work and how to properly expose and use a property when it updated. This time I went right to my model and made the very simple changes. Those worked as expected. 🥳

AHHHHHH!Now, to be clear, I’d tried some combination of things prior to this attempt and they all failed. Why didn’t I do it this way to start with? Well, I’m dumb, and stubborn, and wanted it to work a certain way, so I kept trying to do it my way. Sure, I used Combine and @Publish and ObservableObject, and the other macro I’m forgetting at the moment, or some other combination of those.

This time I told myself “Just bite the bullet and do it exactly like the documentation says, don’t try to fit it into your model.”

It works. I’m happy about it.

I stubbed out Command+click options on the cell and added some print statements just to make sure it did stuff. It did.

I packaged up my laptop and headed home. Now I sit here tying this up. I’ve been banging my head against a wall off and on since December of last year. I am an idiot and maybe I should quit?

Problem is, I really want to make this app. 😁

Time to hit publish and go mow the lawn, where I’ll think about my next steps for Stream for Mac. For the time being I’m freed of that burden I carried for so long.

Now I can do the features I need to ship the first release.

That is a good feeling. 👍🏼