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 DispatchSourceTimer object is used to provide tempo updates.

    Warning

    Do not call the cancel() 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 TimerTempo object and starts the internal timer.

    Declaration

    Swift

    @MainActor
    public convenience init(withInterval interval: TimeInterval? = nil)

    Parameters

    interval

    The 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 TimerTempo object.

  • Calling this method cancels the DispatchSourceTimer object to prepare for deallocation.

    Declaration

    Swift

    @MainActor
    public func cleanupResources()