Sonoma beta release notes mention that NSMenu was rewritten from scratch using AppKit, however, it seems like a lot of behavior was removed along the way which breaks applications. I've filed several requests using Feedback Assistant, but none of them were fixed in the 3 following betas.
FB12867496: NSMenu no longer receives keyboard events from GetEventDispatcherTarget (there is a workaround)
FB12867573: NSMenuItem custom view window is nil
FB12887219 : NSMenu performSelector highlightItem doesn't highlight menu item
FB12938907: NSMenu not properly updated when adding/removing NSMenuItem
I wonder if anyone else has experienced similar problems and can share workarounds for them:
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Is there any modern example of how to create a sandboxed application that provides a spelling service to other macOS applications? The example out there are all in Objective-C and doesn't work when run in modern Xcode.
Is it possible to create a custom scene that would provide a Window instance backed by NSPanel on macOS instead of regular NSWindow?
Ideally, I would have the following in my app:
@main
struct MaccyApp: App {
var body: some Scene {
Panel("Maccy", id: "org.p0deje.Maccy") { // similar to Window(...)
ContentView()
}
}
}
where Panel would implement a custom logic to present itself so the views could access scenePhase, openWindow and dismiss and other common environment values.
I know there is a way to access window and customize it by implement an NSViewRepresentable view with makeNSView(context:), however there is no way to replace the used window with a different implementation class such as NSPanel.
Topic:
UI Frameworks
SubTopic:
SwiftUI