-
Man Reader 2.1
I've just released Man Reader 2.1. Visually, this is very similar to the previous version, but there are a lot of quality of life improvements under the hood.
The most important feature of this release is that the app no longer crashes when typing fast into the search field. Sorry it took me so long to fix this, which was due to the way the app communicated between the AppKit list in the sidebar and the SwiftUI search field. SwiftUI lists have become a lot more performant, so I put a lot of effort into trying to make the entire app SwiftUI but in the end, it was just too sluggish so I reverted to AppKit, but with added traps to avoid crashing.
-
Swift Measurements
Recently, I was working with units and unit conversions in Swift. After a while, I then remembered that Swift has a built-in structure for doing this:
Measurement
. This article is an introduction to the power and usage ofMeasurement
. -
Moving to Eleventy
I have been running this blog since 2014 and it's seen several major changes along the way. I started with WordPress but it felt slow and clumsy, so in 2015 I entered the world of static site generators and transferred to Jekyll. That worked for a couple of years until Jekyll was updated from version 2 to version 3 which broke my setup. At that point I converted to Hugo which has worked fine for more than six years.
But as with Jekyll, updates broke my site and I didn't know enough about how it all worked to fix it. As a temporary measure, I reverted to an old version of Hugo which got everything working again, but this was not a long term solution.
After considering a number of options, I decided to try Eleventy and that's what you're looking at right now.
-
macOS Apprentice Update
The second edition of macOS Apprentice has been released!
If you're a beginner or near-beginner who wants to start learning Swift, SwiftUI and AppKit for building Mac apps, then this is the book for you.
This edition has been updated for Swift 5.9, macOS 15 and Xcode 16.2.
-
The Mac Menubar and SwiftUI
When you create a Mac app using SwiftUI, you get the standard Mac menubar by default. The
commands
modifier lets you customize the menu bar, either by adding, replacing or removing items and menus. You can even add some presets which give a consistent way to add groups of common items.The problem comes when you want to communicate back to the SwiftUI views from the menubar. How can you direct your menubar commands to the correct destination? AppKit uses the responder chain, so it effectively broadcasts any menubar message until something handles it. This might be an edit field, a view, a window or even the app itself. SwiftUI doesn't work like this, but I've explored multiple possibilities for passing messages from the menubar to the active window.