Search code examples
xcodeswiftswift2nsviewcontroller

How can I make an NSViewController topmost in Xcode?


I would like to know if there is a way to make one of my NSViewControllers stay on top of the rest of them in Xcode or Swift 2. I am also working with OS X Cocoa. Thanks!


Solution

  • I assume you have NSViewControllers in multiple windows, and it's one of the windows that you want to keep on top of the others. This is done by setting the window.level:

    window.level = Int(CGWindowLevelForKey(.FloatingWindowLevelKey))