I'm currently developing an application in OSX and I want to open my application when the user press a keyboard combos.
Yes It Is Possible
If your applications was already opened by the user, you need only implement the keyDown(with event: NSEvent) function:
func keyDown(with event: NSEvent) {
guard let e = event.characters else {
return
}
//Do something based on keyboard input
}
If you are trying to get access to keys when your application isn't open, you've essentially implemented a keylogger
But You Really Shouldn't
From your question, it would seem that you want the latter option. This is problematic for 3 reasons:
If, however, you're absolutely certain that you need this functionality, there is a generally agreed upon solution (edited)
Some Friendly Advice
As I'm sure you've noticed, your question wasn't particularly well received. To improve the responses you get in the future, just read the Stack Overflow Question Guide which, tl;dr entails:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With