Reputation: 957
I have a SwiftUI app with 2 Window
s, the second is opened by pressing a button on the first.
The window that opens with the app can be maximized (to full screen, no menubar visible) but the second can only be "zoomed" to fill the full desktop, and cannot enter full screen mode (the green stoplight button only shows +
and even pressing option doesn't show an option to enter full screen). If I use a WindowGroup
instead of Window
for the second window it can enter full screen mode (but I'd have to add custom logic to make sure only one is created which is what I did before Window was added to SwiftUI)
Any ideas what the issue is? Relevant app code below
@main
struct MyApp: App {
@Environment(\.openWindow) private var openWindowEnv
@MainActor func openWindow() async {
openWindowEnv(id: "mirror")
}
var body: some Scene {
Window("First Window", id: "firstWindow") {
ContentView() //normal SwiftUI stuff
}
Window("Second Window", id: "mirror"){
AnotherView() //this is a NSViewRepresentable, not a normal SwiftUI view
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.defaultSize(width: 1920, height: 1080) //same effect with or without this
}
}
Upvotes: 0
Views: 32