SwiftUI and broken Preferences Pane in Ventura

Hi,

I'm the author of a SwiftUI app that hides its dock icon and has a presence in the menu bar. Since the Ventura beta releases, the application can no longer show the preferences window. It's not available either by the button in the main interface window, or from the menu that pops up when you click the icon in the menu bar.

Any idea how/why this has apparently changed? I've used all the beta releases of both Ventura and Xcode up to the current fifth release and this element of my application has been consistently broken. I've already submitted this using "Feedback Assistant", and I'm not really doing anything exotic in my application, so I'm not seeing any warnings or other errors during compilation that would suggest API changes are to blame.

Thanks in advance

  • Matt

Abbreviated code snippets:

   init() { }
   var body: some Scene {
        Settings { PreferencesView() }      // Defines the application setting/preferences window
        WindowGroup {                       // Display the main content browser application window
            MainView(database: database, windowVisible: $windowVisible)
        }
    }
}

struct PreferencesView: View {
    var body: some View {
        TabView {
            GeneralPreferencesView()
		...

The function call has been renamed in macOS 13 Ventura.

The solution:

       // Version specific function call, as this changed in macOS 13 (Ventura)
      if #available(macOS 13, *) {
        NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
      } else {
        NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
      }
SwiftUI and broken Preferences Pane in Ventura
 
 
Q