Is there a pure-SwiftUI way to open a new window? I have a sorta-working document-based app whose app looks like this:
@main struct MyApp: App
{
var
body: some Scene {
DocumentGroup(newDocument: ProjectDocument.init) { inGroup in
ProjectWindowContentView(document: inGroup.document)
.frame(minWidth: 301.0, minHeight: 100.0)
.onReceive(self.addTerrainGeneratorLayerCommand) { _ in
inGroup.document.addTerrainGeneratorLayer()
}
}
.commands {
...
}
}
...
}
Now I want to add a menu command to instantiate a little self-contained utility tool in its own window. So far any discussion I see online actually involves making a new NSWindow with an NSHostingView as its content view. This seems not very SwiftUI-ish, and given their recent additions of DocumentGroup and WindowGroup seems like a pretty big oversight.
I tried putting a WindowGroup in the app’s scene, but it only shows my window if I comment out the DocumentGroup.


