Search code examples
swiftuimac-catalyst

SwiftUI's Settings window for macOS does not show up on a Catalyst app


I have a simple app with an iOS target that is configured for iPhone, iPad, and Mac, making it a Catalyst app. On Xcode 12.0 Beta 1, I tried adding a Settings scene to my app. The documentation page says it is compatible with both macOS 11.0+ and Mac Catalyst 14.0+. The entirety of my app is this:

import SwiftUI

@main
struct TestSettingsApp: App {
  @SceneBuilder var body: some Scene {
    WindowGroup {
      Text("Hello, world!").padding()
    }
    
    #if os(macOS)
    Settings {
      Text("Settings here.")
    }
    #endif
  }
}

Based on the WWDC 2020 What's new in SwiftUI video (4:50), I would expect this to automatically add a "Preferences..." menu option, which would show "Settings here." However, this option never shows up. I also tried replacing #if os(macOS) with #if targetEnvironment(macCatalyst), which had no effect.


Solution

  • It turns out that Apple's documentation was either incorrect early on in the beta period, or they decided not to implement Settings for Mac Catalyst. The documentation page I referred to earlier has since been updated to remove "Mac Catalyst 14.0+".