title: Present view controller programmatically from NSWindowController
body: <p>I am working with swift 4 for macOS and I can show another view controller programmatically with this code:</p>
  
  <pre><code>@IBAction func showVC(_ sender: NSButton) {
      let vc = NSStoryboard(name: NSStoryboard.Name(rawValue: "Main"), bundle: nil).instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "MyVC")) as! NSViewController
      self.presentViewController(vc, asPopoverRelativeTo: sender.bounds, of: sender, preferredEdge: .maxX, behavior: .transient)
  }
  </code></pre>
  
  <p>Now I would like to do the same from a NSWindowController, but I get below "error":</p>
  
  <p><code>value of type 'WindowController' has no member 'presentViewController'</code></p>
  
  <p>Is there another way to realize it?</p>
  
  <p><strong>NEXT TRY</strong></p>
  
  <pre><code>   @IBAction func showVC(_ sender: NSToolbarItem) {
      let vc = NSStoryboard(name: NSStoryboard.Name(rawValue: "Main"), bundle: nil).instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "MyVC")) as! NSViewController
  self.contentViewController?.presentViewController(x, asPopoverRelativeTo: sender.view!.bounds, of: sender.view!, preferredEdge: .maxX, behavior: .transient)
  
      }        
  </code></pre>
  
  <p>the app crashes on the second line with:</p>
  
  <p><code>fatal error: unexpectedly found nil while unwrapping an Optional value</code></p>
  
  <p>i check following:</p>
  
  <pre><code>print(sender.view?.bounds ?? "No bounds")
  print(sender.view ?? "No view")
  </code></pre>
  
  <p><strong>Print result</strong></p>
  
  <pre><code>No bounds
  No view
  </code></pre>
  
  <p>But why??</p>