title: Connect to ViewController from AppDelegate (Swift)
body: <p>I have created a new OS X Cocoa Application using the standard Xcode Swift template (using StoryBoards).</p>
  
  <p>I have implemented an IBAction in AppDelegate.swift to handle when the users selects "Open..." from the "File" menu. If the chosen file is a valid image file, I create an NSImage which I then want to display in the view of ViewController.</p>
  
  <pre><code>    @IBAction func openFile(sender: NSMenuItem) {
      var openPanel = NSOpenPanel()
      openPanel.beginWithCompletionHandler { (result :Int) -&gt; Void in
          if result == NSFileHandlingPanelOKButton {
              if let imageURL = openPanel.URL {
                  let image = NSImage(contentsOfURL: imageURL)
                  // PRESENT image IN THE VIEW CONTROLLER
              }
          }
      }
  </code></pre>
  
  <p>However, I don't see any way to connect to ViewController from AppDelegate. I have only managed to find suggestions that I should look at self.window! in AppDelegate, but there is no such thing as a window in AppDelegate.</p>
  
  <p>Thanks,
  Michael Knudsen</p>