Created
September 6, 2016 12:51
-
-
Save DivineDominion/13e2f89378a1b8e3e33cea9918e5a6d1 to your computer and use it in GitHub Desktop.
Showing any NSWindowController as an app modal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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