Interestingly, the issue seems to arise when NSColor.controlAccentColor is called anywhere in the code.
Removing this reference resolves the issue. If you still need the accent color as a NSColor, you can use the following workaround
// ❌ breaks SwiftUI accent color
let color = NSColor.controlAccentColor
// ✅ uses the SwiftUI accentColor as value
let color = NSColor(.accentColor)
I filed a radar under FB13688723
I've been running into the exact same issue myself. It seems that simply referencing the constant NSUserActivityTypeLockedCameraCapture—even if it’s protected by an if #available check—causes a crash on devices running any iOS version below 18. Essentially, there's just no safe way to use that constant on iOS 18 and still maintain backward compatibility.
This is definitely one of those cases where an Apple engineer needs to step in and provide a fix or an official workaround.
Interestingly, the issue seems to arise when NSColor.controlAccentColor is called anywhere in the code.
Removing this reference resolves the issue. If you still need the accent color as a NSColor, you can use the following workaround
// ❌ breaks SwiftUI accent color
let color = NSColor.controlAccentColor
// ✅ uses the SwiftUI accentColor as value
let color = NSColor(.accentColor)
I filed a radar under FB13688723
I've been running into the exact same issue myself. It seems that simply referencing the constant NSUserActivityTypeLockedCameraCapture—even if it’s protected by an if #available check—causes a crash on devices running any iOS version below 18. Essentially, there's just no safe way to use that constant on iOS 18 and still maintain backward compatibility.
This is definitely one of those cases where an Apple engineer needs to step in and provide a fix or an official workaround.