quitting xcode cocoa swift app

You should be able to just call terminate on the global NSApp object.


Swift 4 & 5:

@IBAction func ExitNow(sender: AnyObject) {
    NSApplication.shared.terminate(self)
}

Swift 3:

@IBAction func ExitNow(sender: AnyObject) {
    NSApplication.shared().terminate(self)
}

Swift 2:

@IBAction func ExitNow(sender: AnyObject) {
    NSApplication.sharedApplication().terminate(self)
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)