Easily linking any AppKit or UIKit class with SwiftUI

After spending an embarrassing amount of hours trying to get TextField to do what I needed on macOS I decided to try NSViewRepresentable + NSTextField. I was fully prepared to spend the night on this… Yet I got it done in 30m 😮  Lesson learned! Going forward, when a SwiftUI object is not mature enough …

Restoring macOS window after close – SwiftUI WindowsGroup

Typical behavior for macOS apps is that the apps will preserve their size and position when closed (Command + W) or quit (Command + Q) by the user.    When using SwiftUI & WindowsGroup that’s not the case though: although it works as designed when quitting, it forgets position and size when closing the window …

Enabling undo CoreData + SwiftUI

I did a post a while back about how to enable undo functionality when using CoreData. It continues to work great for AppKit or UIKit apps, but what about if you’ve adopted SwiftUI as Apple is suggesting we do? Well… unfortunately the previous approach won’t work quite as well. After a few hours working this, …

SideBar: The Silent Super-Feature

If done right you will almost never notice it.. It is however one of the most used parts of any app: the sidebar.  With MarsManaged we’ve gone through quite a few iterations. Here’s a retrospective on the improvements made, and the thinking behind them.  First Iteration (A): Although it was purely a SwiftUI non-functional prototype, …

MarsManaged July Update: New Palette, Icon, UX Improvements…

Back in Sunny California! Portugal was great: the food, the weather, the people… In between hikes, museums and reading breaks I’ve done quite a bit of progress on MarsManaged: it’s looking better and better. Every day a bit more polished and user feedback is helping raise the bar big time. Here’s how the main screen looks like now: …

Replacing NSTextView text programmatically without affecting its style and format

In the previous post I discussed the addition of Dynamic Date parsing to MarsManaged. In a nutshell: actions containing certain keywords (i.e. today, tomorrow, next month) are automatically converted to target dates.  High level, the flow is as follows: Nice right? Well, I quickly discovered an unexpected surprise: the TextView format was being lost when the keyword …

Adding an overlay when there’s no content to show – SwiftUI Empty States

Empty states. Or to put it another way, what do you show when a view is devoid of any content?  This is an area that not all apps account for. The ones that do though, not only improve the end-user experience but also feel more… complete?  Here’s some examples of empty states. 1. NetNewsWire (a great RSS …

Creating a macOS “About” screen the SwiftUI way

If you’re creating a macOS app, the About screen is that place where you get to “sign” your work. It is also the place where most developers will link to their personal web, thank contributors, etc.  For me, it’s one of the areas I work on last… When I get to it, it always feels great.  …

Badges? Gray Badges? Color Badges!

As I was working on cell badges indicating the number of to-dos pending for a given card it hit me…   The approach I was taking was good, it gave relevant and timely information… But could be much better: what if the flag changes color when you have a to-do overdue, due today, tomorrow or soon?   This …