TimerTempo
@MainActor
public class TimerTempo : TempoProviding
TimerTempo uses an internal DispatchSourceTimer object to send out tempo updates. By default, the update interval is twice the maximum refresh rate of the current display.
-
This
DispatchSourceTimerobject is used to provide tempo updates.Warning
Do not call thecancel()method on this object, as its state is handled by TimerTempo directly.Declaration
Swift
@MainActor public var timer: DispatchSourceTimer? -
Declaration
Swift
@MainActor public weak var delegate: TempoDelegate? -
Initializes a new
TimerTempoobject and starts the internal timer.Declaration
Swift
@MainActor public convenience init(withInterval interval: TimeInterval? = nil)Parameters
intervalThe rate, in number of seconds, between updates of the timer. If no value is provided, the default value is twice the maximum refresh rate of the current display.
Return Value
A new
TimerTempoobject. -
Calling this method cancels the
DispatchSourceTimerobject to prepare for deallocation.Declaration
Swift
@MainActor public func cleanupResources()
View on GitHub