Skip to content

Commit

Permalink
quit app
Browse files Browse the repository at this point in the history
  • Loading branch information
rlxone committed Apr 3, 2017
1 parent 5dcb2c2 commit 39a52f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DynamicsIllusion.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.rlxone.DynamicsIllusion;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0;
};
name = Debug;
Expand All @@ -324,6 +325,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.rlxone.DynamicsIllusion;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0;
};
name = Release;
Expand Down
11 changes: 11 additions & 0 deletions DynamicsIllusion/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import Cocoa
import AudioToolbox
import ScriptingBridge

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
Expand Down Expand Up @@ -78,13 +79,23 @@ class AppDelegate: NSObject, NSApplicationDelegate {
menu.addItem(item)
}

menu.addItem(NSMenuItem.separator())

item = NSMenuItem(title: "Quit", action: #selector(self.menuQuitAction), keyEquivalent: "q")
menu.addItem(item)

statusItem.menu = menu
}

override func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
return menuItem.isEnabled
}

func menuQuitAction() {
NSApplication.shared().terminate(self)

}

func menuItemAction(sender: NSMenuItem) {
for item in (statusItem.menu?.items)! {
if item == sender {
Expand Down

0 comments on commit 39a52f1

Please sign in to comment.