Reputation: 20766
Is there any way to capture global key presses (even when my application isn't active) in Mac OS using Swift?
Thanks in advance.
Upvotes: 6
Views: 2590
Reputation: 518
Yes, you can use NSEvent to add a global event monitor. Checkout this Swift 3 example here: https://stackoverflow.com/a/40509620/1791525
Upvotes: 3