CGEventTapCallBack needs to return NULL

The documentation for CGEventTapCallBack says to return NULL if an event is to be deleted otherwise to return Unmanged.

I have an Objective-C app that uses this feature and I am converting it to Swift using Xcode 9.3.1


The current Swift documentation of CGEventTapCallBack says


If the event tap is an active filter, your callback function should return one of the following:

  • The (possibly modified) event that is passed in. This event is passed back to the event system.
  • A newly-constructed event. After the new event has been passed back to the event system, the new event will be released along with the original event.
  • NULL if the event passed in is to be deleted.


How do I accomplish this NULL return value in Swift which is looking for a CGEvent?

Powered by WPeMatico

You may also like...

Comments are closed.