Contents

AXObserverGetRunLoopSource(_:)

Returns the observer's run loop source.

Declaration

func AXObserverGetRunLoopSource(_ observer: AXObserver) -> CFRunLoopSource

Parameters

Return Value

Returns the CFRunLoopSourceRef of the observer; NIL if you pass NIL in observer.

Discussion

The observer must be added to a run loop before it can receive notifications. Note that releasing the AXObserverRef automatically removes the run loop source from the run loop (you can also do this explicitly by calling CFRunLoopRemoveSource(_:_:_:)).

AXObserverGetRunLoopSource might be used in code in this way:

 
 CFRunLoopAddSource(CFRunLoopGetCurrent(), AXObserverGetRunLoopSource(observer), kCFRunLoopDefaultMode);
 

See Also

Notification API