Adds a CFRunLoopObserver object to a run loop mode.


func CFRunLoopAddObserver(_ rl: CFRunLoop!, _ observer: CFRunLoopObserver!, _ mode: CFRunLoopMode!)



The run loop to modify.


The run loop observer to add.


The run loop mode to which to add observer. Use the constant commonModes to add observer to the set of objects monitored by all the common modes.


A run loop observer can be registered in only one run loop at a time, although it can be added to multiple run loop modes within that run loop.

If rl already contains observer in mode, this function does nothing.

See Also

Managing Observers

func CFRunLoopContainsObserver(CFRunLoop!, CFRunLoopObserver!, CFRunLoopMode!) -> Bool

Returns a Boolean value that indicates whether a run loop mode contains a particular CFRunLoopObserver object.

func CFRunLoopRemoveObserver(CFRunLoop!, CFRunLoopObserver!, CFRunLoopMode!)

Removes a CFRunLoopObserver object from a run loop mode.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software