Skip to content

Instantly share code, notes, and snippets.

@DivineDominion
Created September 6, 2016 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DivineDominion/13e2f89378a1b8e3e33cea9918e5a6d1 to your computer and use it in GitHub Desktop.
Save DivineDominion/13e2f89378a1b8e3e33cea9918e5a6d1 to your computer and use it in GitHub Desktop.
Showing any NSWindowController as an app modal
class ModalDialogController: NSWindowController {
convenience init() {
self.init(windowNibName: "ModalDialogController")
}
@IBOutlet var closeButton: NSButton!
override func windowDidLoad() {
super.windowDidLoad()
self.window?.level = Int(CGWindowLevelForKey(CGWindowLevelKey.ModalPanelWindowLevelKey))
}
@IBAction func close(sender: AnyObject!) {
self.close()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment