If you configure a Window and a MenuBarExtra in your app, try this:
- Open your app and press
Command+H
to hide it. - Place an iPad or another Mac and connect two devices via Universal Control, and click on the other device to make your mac's menu bar inactive.
- Move your cursor back to your Mac(first device), and click on the whitespace of the Menu Bar.
- Your App is terminated unexpectedly.
This behavior will only appear on those apps using Window
, so to solve this issue, we may need to switch Window
to WindowGroup
which is not what we want.
I reappear this issue on Apple's ScreenCaptureKit Sample Code. This is a SwiftUI Scene BUG, please fix this.
@main
struct CaptureSampleApp: App {
var body: some Scene {
Window("ID", id: "ID") {
ContentView()
.frame(minWidth: 960, minHeight: 724)
.background(.black)
}
MenuBarExtra(
"App Menu Bar Extra", systemImage: "star"
) {
Text("Hello")
}
}
}
Filed a feedback: FB11447959.