Post

Replies

Boosts

Views

Activity

Reply to Window NSWindow 0x137632e40 ordered front from a non-active application and may order beneath the active application's windows
This is not a meaningless issue. This will cause unexpected behavior like error alert doesn't show in SwiftUI. If you encounter the same like me. You can get the window and make it key and front to fix this issue. I used https://github.com/happycodelucky/SwiftUIWindowBinder to get the NSWindow. And used below func to make it key and front. var body: some View { WindowBinder(window: $window) { // content view } .onAppear { makeKeyAndFront() } } private func makeKeyAndFront() { if let window { window.makeKeyAndOrderFront(nil) } else { DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) { makeKeyAndFront() } } }
Jul ’23