title: SwiftUI on Mac: Close Window and open another one
body: <p>I'm new to SwiftUI and it's so much to overthink after using storboards for years. I try to convert my previous storyboard application and unfortunately, there are only tutorials for iOS. Nevermind, my question...:</p>
  
  <p>My application will start with a login window. If the login is successful, the window should close and a new window with the main application should appear. Now I'm sitting in front of my login window and an empty button function:</p>
  
  <p><em>AppDelegate.swift:</em></p>
  
  <pre><code>let contentView = LoginView()
  ...
  window.contentView = NSHostingView(rootView: contentView)
  window.makeKeyAndOrderFront(nil)
  </code></pre>
  
  <p><em>LoginWindow.Swift:</em></p>
  
  <pre><code>Button(action: {
  
  }) {
      Text("Login")
  }
  </code></pre>
  
  <p>What should I write into the button action? How and where do I call the login function and how will this function change the windows, if the login is successful?</p>