title: Reference main NSWindow in AppDelegate using Storyboard?
body: <p>I am attempting to set an outlet for the main window of my app in my App Delegate, then connect it within Interface Builder. I create the outlet within my App Delegate easily:</p>
  
  <pre><code>@IBOutlet weak var mainWindow: NSWindow!
  </code></pre>
  
  <p>However there's no way, within interface builder, for me to connect a referencing outlet to the App Delegate. Instead, I can only connect it to the Window Controller, which I hope this picture shows:</p>
  
  <p><img src="https://i.stack.imgur.com/rZgxA.png" alt="enter image description here"></p>
  
  <p>The first object is the Window Controller and the second object is the First Responder, however the App Delegate object is missing. The menubar has the App Delegate object:</p>
  
  <p><img src="https://i.stack.imgur.com/oOsJx.png" alt="enter image description here"></p>
  
  <p>And I can connect anything from the menubar to any outlets in the App Delegate.</p>
  
  <p>I figure I can access the window object by using:</p>
  
  <pre><code>NSApp.windows[0]
  </code></pre>
  
  <p>But that seems prone to error, especially if I have more than one window.</p>