CurrentThreadScheduler

public class CurrentThreadScheduler : ImmediateSchedulerType

Represents an object that schedules units of work on the current thread.

This is the default scheduler for operators that generate elements.

This scheduler is also sometimes called trampoline scheduler.

  • The singleton instance of the current thread scheduler.

    Declaration

    Swift

    public static let instance: CurrentThreadScheduler
  • Gets a value that indicates whether the caller must call a schedule method.

    Declaration

    Swift

    public private(set) static var isScheduleRequired: Bool { get set }
  • Schedules an action to be executed as soon as possible on current thread.

    If this method is called on some thread that doesn’t have CurrentThreadScheduler installed, scheduler will be automatically installed and uninstalled after all work is performed.

    Declaration

    Swift

    public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).