Type Method


Creates a new dispatch source object for monitoring timer events.


class func makeTimerSource(flags: DispatchSource.TimerFlags = [], queue: DispatchQueue? = nil) -> DispatchSourceTimer



Additional flags indicating the behavior of the timer. For a list of possible values, see DispatchSource.TimerFlags.


The dispatch queue to which to execute the installed handlers.

Return Value

A dispatch source object that conforms to the DispatchSourceTimer protocol.


After creating the dispatch source, use the methods of the DispatchSourceProtocol protocol to install the event handlers you need. The returned dispatch source is in the inactive state initially. When you are ready to begin processing events, call its activate() method.

To schedule timers, use the methods of the DispatchSourceTimer protocol. You may schedule timers that fire once or fire multiple times. Each time the timer fires, the dispatch source calls your installed event handler.

See Also

Creating a Timer Source

protocol DispatchSourceTimer

A dispatch source that submits the event handler block based on a timer.

struct DispatchSource.TimerFlags

Flags to use when configuring a timer dispatch source.

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