FrozenHeart
FrozenHeart

Reputation: 20766

Is there any way to capture global key presses in Mac OS using Swift

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

Answers (1)

Daniel Sposito
Daniel Sposito

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

Related Questions