Pods/ShortcutRecorder/README.md
The best control to record shortcuts on macOS
The framework comes with:
SRRecorderControl to render and capture user inputSRRecorderControlStyle for custom stylingSRShortcut that represents a shortcut modelSRGlobalShortcutMonitor to turn the shortcut into an action by registering a global hot keySRLocalShortcutMonitor for manual handling in the responder chain and NSEvent monitorsSRShortcutController for smooth Cocoa Bindings and seamless Interface Builder integrationSRShortcutValidator to check validity of the shortcut against Cocoa key equivalents and global hot keysNSValueTransformer and NSFormatter subclasses for custom alternationsimport ShortcutRecorder
let defaults = NSUserDefaultsController.shared
let keyPath = "values.shortcut"
let options = [NSBindingOption.valueTransformerName: .keyedUnarchiveFromDataTransformerName]
let beepAction = ShortcutAction(keyPath: keyPath, of: defaults) { _ in
NSSound.beep()
return true
}
GlobalShortcutMonitor.shared.addAction(beepAction, forKeyEvent: .down)
let recorder = RecorderControl()
recorder.bind(.value, to: defaults, withKeyPath: keyPath, options: options)
recorder.objectValue = Shortcut(keyEquivalent: "⇧⌘A")
The framework supports module maps, explicit linking is not required: simply import ShortcutRecorder / #import <ShortcutRecorder/ShortcutRecorder.h>
pod 'ShortcutRecorder', '~> 3.1'
github "Kentzo/ShortcutRecorder" ~> 3.1
Prebuilt frameworks are available.
Add the submodule:
git submodule add git://github.com/Kentzo/ShortcutRecorder.git
Then drag'n'drop into Xcode workspace of your project.
Still have questions? Create an issue.
Paid support is available for custom alterations, help with integration and general advice regarding Cocoa development.