-
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.
-
macOS by Tutorials 3.0
macOS by Tutorials Edition 3.0 is now available!
The book is available for purchase or update at Gumroad.
If you previously bought the first edition of this book from either Kodeco or Amazon, please email me for a 50% discount code.
If you already bought the second edition from me via Gumroad, this is a free update that you can download from your Gumroad library.
-
Swift Format in Xcode
In Xcode 16, Apple quietly introduced the ability to format your Swift files using Swift Format. I'm a long-time user of SwiftLint, but having such a tool built into Xcode would be a great convenience, so I decided to give it a try. Here is my description of why I use such a tool, how well it works compared to the alternatives, and how I configured it for my own purposes.
-
App Permissions on macOS Sequoia
In 2012, with OS X Mountain Lion, Apple added a feature called Gatekeeper. It had been available earlier as a command line utility, but this was the first time they made it accessible through System Preferences. Gatekeeper allowed users to control which apps could be installed on their Macs by offering three options: allow apps from App Store, App Store and identified developers or Anywhere. This was the start of Apple trying to lock Macs down, similarly to how iOS devices are locked down, but it allowed power users to install any apps they wanted.
In macOS Sierra (2019), the Anywhere option was removed. It was still possible to open any app by right-clicking and selecting Open. You had to get past a couple of warning dialogs, but it worked. Now, in macOS Sequoia, even that has gone. So how can you open an app that isn't signed by an identified developer?
TL;DR: You can still run unsigned apps, but it's a bit more difficult. After trying once, you have to go to System Settings -> Privacy & Security, scroll to the end and click Open Anyway for that app.