You should be able to just call terminate on the global NSApp
object.
@IBAction func ExitNow(sender: AnyObject) {
NSApplication.sharedApplication().terminate(self)
}
Edit With Swift 3 the code is now:
@IBAction func ExitNow(sender: AnyObject) {
NSApplication.shared().terminate(self)
}
Edit 2 With Swift 4 & 5 the code is now:
@IBAction func ExitNow(sender: AnyObject) {
NSApplication.shared.terminate(self)
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…