title: Swift 3/macOS: Open window on certain screen
body: <p>Beginner question:</p>
  
  <p>I am working on a macOS App with current Xcode 8.3.3 and Swift3. I am using MASShortcut to open a window by a shortcut that has been hidden by startup.</p>
  
  <p>I use the following code on the shortcut event:</p>
  
  <pre><code>NSApplication.shared().windows.last!.makeKeyAndOrderFront(nil)
  NSApplication.shared().activate(ignoringOtherApps: true)
  </code></pre>
  
  <p>For multiple monitor setups (I have two external displays attached to my MacBook), I want to specify the screen where the window pops up. I know there is NSScreen.screens() that gives back all available screens. But how do I use it for letting my window pop up on screen 1/2/3?</p>
  
  <p>Thanks a lot!</p>
  
  <p>Edit: Solved with the answer of @michael-doltermann:</p>
  
  <p>I can iterate over NSScreen.screens() and access for example the midX/midY coords to create a NSPoint instance to replace my window.</p>
  
  <pre><code>var pos = NSPoint()
  pos.x = NSScreen.screens()![myIndex].visibleFrame.midX)
  pos.y = NSScreen.screens()![myIndex].visibleFrame.midY)
  self.window?.setFrameOrigin(pos)
  </code></pre>