title: How do I open another window in macOS in Swift with Cocoa
body: <p>I am working on a macOS app that presents a list of customer master records in a table view. Double-clicking a row in the table view should open a new window where the user can view and edit the customer information. </p>
  
  <p>This is an Xcode 8.3.3 project using a storyboard and Swift.<br>
  It is not a document or core data app.</p>
  
  <p>I have the main window working up to the point where the table view is displaying the records correctly and the associated view controller is receiving the double-click events and logging them to the console.</p>
  
  <p>I have created an additional window controller and view for the edit window and verified its basic functionality by temporarily marking it as the initial controller.</p>
  
  <p>What I haven't been able to figure out is how to display a new instance of that window when the user double-clicks a row.</p>
  
  <p>Thanks to @Joshua Nozzi I'm closer. Here is the code at this point.  </p>
  
  <pre><code>let storyboard = NSStoryboard(name: "Main", bundle: nil)
  if let windowController = storyboard.instantiateController(withIdentifier: "xyzzy") as? NSWindowController
  {
    windowController.showWindow(self)
  }
  </code></pre>
  
  <p>It's generating a </p>
  
  <blockquote>
    <p>(Storyboard: 0x620000000680) doesn't contain a controller with
    identifier 'xyzzy'</p>
  </blockquote>
  
  <p>error.</p>