// // AppDelegate.swift // Converter // // Created by Kilian Hofmann on 21.06.17. // Copyright © 2017 Kilian Hofmann. All rights reserved. // import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { var isConverting: Bool = false func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply { guard isConverting else { return NSApplication.TerminateReply.terminateNow } return NSApplication.TerminateReply.terminateCancel } func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } }