UIScheduler

public final class UIScheduler : Scheduler

A scheduler that performs all work on the main queue, as soon as possible.

If the caller is already running on the main queue when an action is scheduled, it may be run synchronously. However, ordering between actions will always be preserved.

  • Initializes UIScheduler

    Declaration

    Swift

    public init()
  • Queues an action to be performed on main queue. If the action is called on the main thread and no work is queued, no scheduling takes place and the action is called instantly.

    Declaration

    Swift

    @discardableResult
    public func schedule(_ action: @escaping () -> Void) -> Disposable?

    Parameters

    action

    A closure of the action to be performed on the main thread.

    Return Value

    Disposable that can be used to cancel the work before it begins.