Back to Rxswift

CurrentThreadScheduler

docs/Classes/CurrentThreadScheduler.html

6.10.21.5 KB
Original Source

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.

`

                instance
                `

The singleton instance of the current thread scheduler.

Declaration

Swift

public static let instance: CurrentThreadScheduler

`

                isScheduleRequired
                `

Gets a value that indicates whether the caller must call a schedule method.

Declaration

Swift

public private(set) static var isScheduleRequired: Bool { get set }

`

                schedule(_:action:)
                `

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).