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 …

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 …

TextField Recommendations / Autocomplete – SwiftUI macOS and iOS

Another weekend, another set of improvements for MarsManaged. This time, I focused on adding an autocompletion feature for Tags. Let me provide some context first… In MarsManaged, cards may be linked to one or multiple tags. In the below example, the “Welcome to MarsManaged!” card is linked to the tag “Samples” (yellow arrow).  To link one …

MenuBar Items in SwiftUI

Before SwiftUI you would easily add, change or remove menuBarItems from your app Storyboard. With the transition to SwiftUI however, there’s no longer a StoryBoard file to edit… So, what now? After the initial surprise, and having spent a few hours reading documentation… It’s actually a very straightforward three step process: 1. In your @main …

Preventing edits in TextFields unless cell is selected

For the ToDo section in MarsManaged, the goal is for the user to see and quickly manage their upcoming tasks.  The user should be able to easily tweak bookmarked tasks, set target dates, complete or delete them. Now, given that each cell is composed of multiple editable TextFields, it’s important to prevent unintended editing on …

Developing on the cutting edge

If you’re working on a new app using the latest Xcode & macOS Monterey betas be aware of a bug that leads to SceneStorage failures appearing on the console: Failed to restore SceneStorage with key selectedTaskId. at SwiftUI/SceneStorage.swift:105[…]Failed to restore SceneStorage with key sidebarSelection. at SwiftUI/SceneStorage.swift:105Binary[2571:23261] Checked for defaults IMKUseDistributedObjects. result is 0Binary[2571:23261] IMK will …