title: SwiftUI (macOS) how to pass a variable to a new window (WindowGroup)?
body: <p>I'm trying to use the new WindowGroup to display a more complex view in a new window but somehow I can't figure out how to pass values into the view. <br/>
  Until yet I was playing around with NSWindow but there I can't use the new toolbar with <code>.toolbar{}</code> and I'm somehow getting weird errors when using the latest swiftUI features.<br/><br/>
  In my old code I just could pass my values into the new view like usual:</p>
  <pre class="lang-swift prettyprint-override"><code>.simultaneousGesture(TapGesture(count: 2).onEnded {
  
        var window: NSWindow!
  
        if nil == window {
             let serverView = serverView(content: content) // parse my struct content(name: &quot;XServe-Test&quot;, configFile: &quot;/FileUrl&quot;, permissions: .rootPermissions, cluster: cluster(x12, CPUMax: .cores(28), ramMax: .gb(1200)))
             window = NSWindow(
             contentRect: NSRect(x: 20, y: 20, width: 580, height: 400),
             styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
              backing: .buffered,
              defer: false)
              window.center()
              window.setFrameAutosaveName(&quot;ServerMainView&quot;)
              window.isReleasedWhenClosed = false
              window.title = content.name
              window.contentView = NSHostingView(rootView: serverView)
              window.toolbar = NSToolbar()
              window.toolbarStyle = .unifiedCompact
           }
  
        window.makeKeyAndOrderFront(nil)
   }  
  </code></pre>
  <p>Now I'm using in the app file:</p>
  <pre class="lang-swift prettyprint-override"><code>import SwiftUI
  
  @main
  struct myApp: App {
      
      var body: some Scene {
  
          WindowGroup {
              contentView()
          }.windowStyle(HiddenTitleBarWindowStyle())
          .commands {
              SidebarCommands()
              ToolbarCommands()
          }
  
          // the view that should be displayed in a new window 
          WindowGroup(&quot;serverView&quot;) {
              let inputContent : content = content(name: &quot;XServe-Test&quot;, configFile: &quot;/FileUrl&quot;, permissions: .rootPermissions, cluster: cluster(x12, CPUMax: .cores(28), ramMax: .gb(1200))) 
              serverView(content: inputContent) // this is static now :(
          }.handlesExternalEvents(matching: Set(arrayLiteral: &quot;serverView&quot;))
  }
  </code></pre>
  <p>and the following code to open the view:</p>
  <pre class="lang-swift prettyprint-override"><code>  .simultaneousGesture(TapGesture(count: 2).onEnded {
  
    guard let url = URL(string: &quot;com-code-myApp://serverView&quot;) else { return }
          NSWorkspace.shared.open(url)
  }
  </code></pre>
  <p><br/><br/>
  How do I pass the input from the tap gesture into the new view using the WindowGroup logic?</p>