macOS Sonoma & Xcode 15

I have tested the apps in this book using the the current betas of macOS and Xcode. There are really only two things to watch out for. The first applies to developing any Mac app an the second is specific to this book.


Every time you run an app or a SwiftUI preview changes, you’ll get a warning about the app being from “an unidentified developer”. You can click “Open Anyway” to continue, but this gets tedious.

To avoid this, open Xcode > Settings > Accounts and link your Apple ID. This does not need to be a developer account - any Apple ID will work.

Once you’ve linked your account, go back to your project and open the target settings. Go to Signing & Capabilities and set the Team to your newly linked account. You may see the warning once more, but then it will stop popping up.


In Chapter 8 of this macOS Apprentice book, you create a Settings window and apply the user settings to limit the random words chosen by the game. With Xcode 15, using an AppStorage property inside a loop is very slow, at least in debug mode. The solution is to copy the AppStorage values into local variables before the loop.

In Game.swift, find getRandomWord() and insert these lines before the let words = wordsList line:

// Copy AppStorage properties to local variables before filtering
let minWordLength = self.minWordLength
let maxWordLength = self.maxWordLength
let useProperNouns = self.useProperNouns

Then this method will be as fast as it was before.


I will keep checking the betas and reporting any other changes that need to be made, but at this stage, things are looking good.

Happy coding,
Sarah

1 Like