Scheduler

public final class Scheduler

A scheduler for onFixedFrame events.

  • Gets the singleton global instance of Scheduler.

    Declaration

    Swift

    public static let instance: Scheduler
  • Event invoked every time onFixedFrame is invoked; usually aligned to the display’s refresh rate.

    The TimeInterval provided to the function is the time interval elapsed since the last fixed frame event was issued.

    Declaration

    Swift

    @Event
    <TimeInterval> public var fixedFrameEvent: EventSource<TimeInterval> { get }
  • Raises the fixedFrameEvent event. Should be invoked at an interval that is equal to the refresh rate of the monitor.

    Declaration

    Swift

    public func onFixedFrame(_ intervalInSeconds: TimeInterval)
  • Schedules a timer to fire at a specified interval.

    The timer will fire in the main RunLoop, with RunLoop.Mode.default mode.

    The timer is scheduled to fire interval seconds after the current date at the time of calling this method, and if repeats is passed as true, every interval seconds afterwards until SchedulerTimerType.invalidate() is called on the returned timer object.

    Precision of the timer is undefined, but it is guaranteed to not fire before its scheduled time.

    Declaration

    Swift

    public func scheduleTimer(interval: TimeInterval, repeats: Bool = false, _ block: @escaping () -> Void) -> SchedulerTimerType