-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow parameter to be used with HotKey action #9
Conversation
This function is possible by using the closure supported by this PR (#20). func applicationDidFinishLaunching(_ aNotification: Notification) {
// ⌘ + Control + B
guard let keyCombo: KeyCombo = KeyCombo(keyCode: 11, carbonModifiers: 4352) else { return }
let hotKey: HotKey = HotKey(identifier: "CommandControlB",
keyCombo: keyCombo,
- target: self,
- action: #selector(AppDelegate.handleHotKeyEvent(_:)))
+ handler: handleHotKeyEvent)
hotKey.register()
}
-@objc func handleHotKeyEvent(_ hotKey: HotKey) {
+func handleHotKeyEvent(_ hotKey: HotKey) {
let identifier = hotKey.identifier
print(identifier) // CommandControlB
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpherox Sorry for late reply. I made some reviews so can you fix it?
Remove unnecessary annotation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Thanks :)
Released v2.3.1 🎉 |
This change allows you to take advantage of the arguments passed to the callback.