There are several issues here. Before installing them, make sure that you have installed MASShortcut2.1.2 (this can be seen in Podfile.lock). If you do not, you must run pod updateto get the latest version.
- , OS X. Command + Option + Space Finder . , , Control .
. -, keyMask:
let keyMask: NSEventModifierFlags = .CommandKeyMask | .ControlKeyMask | .AlternateKeyMask
, Swift , NSEventModifierFlags ( , .ControlKeyMask ).
Swift , rawValue . rawValue of NSEventModifierFlags UInt, .
keyCode UInt. , :
let keyCode = UInt(kVK_Space)
Swift , , Swift. , shortcutWithKeyCode:modifierFlags:, Swift . , :
let shortcut = MASShortcut(keyCode: keyCode, modifierFlags: keyMask.rawValue)
rawValue - UInt.
, API MASShortcutMonitor. , :
#import <MASShortcut/MASShortcut.h>
, API. :
#import <MASShortcut/MASShortcutMonitor.h>
:
MASShortcutMonitor.sharedMonitor().registerShortcut(shortcut, withAction: callback)
. !
. applicationWillTerminate: :
MASShortcutMonitor.sharedMonitor().unregisterAllShortcuts()