RepeatingTimer

public class RepeatingTimer : Repeater

Safe implementation of a repeating timer for scheduling connectivity checks

  • Declaration

    Swift

    public init(timeInterval: TimeInterval,
                repeating: DispatchTimeInterval? = nil,
                leeway: DispatchTimeInterval = .nanoseconds(0),
                queue: TealiumQueue,
                eventHandler: @escaping () -> Void)

    Parameters

    timeInterval

    TimeInterval in seconds until the timed event happens, and repeating interval by default (if ‘repeating’ is not specified)

    repeating

    The interval to repeat, otherwise the same timeInterval is reused

    queue

    The queue to use for the timer

  • The handler that gets called when the timer fires.

    Declaration

    Swift

    public private(set) var eventHandler: (() -> Void)? { get }
  • Resumes this timer instance if suspended

    Declaration

    Swift

    public func resume()
  • Suspends this timer instance if running

    Declaration

    Swift

    public func suspend()