title: Xcode Swift OS X popover behavior
body: <p>For my small Mac menubar application I'd like the behavior of the popover to be transient, so when it loses focus, it will close. This works for that:</p>
  
  <pre><code>popover.behavior = NSPopoverBehavior.Transient
  </code></pre>
  
  <p>But it only works once, so the second time you click somewhere else the popover stays. I placed the code in <code>func applicationDidFinishLaunching(notification: NSNotification)</code>, but placing it outside this function inside the class did not work. How can I use force this behavior all the time?</p>
  
  <p>I am using Xcode 7.0 with Swift (2.0).</p>