Create Window backed by NSPanel in SwiftUI app

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.

Create Window backed by NSPanel in SwiftUI app
 
 
Q