ConcurrentMainScheduler
public final class ConcurrentMainScheduler : SchedulerType
Abstracts work that needs to be performed on MainThread
. In case schedule
methods are called from main thread, it will perform action immediately without scheduling.
This scheduler is optimized for subscribeOn
operator. If you want to observe observable sequence elements on main thread using observeOn
operator,
MainScheduler
is more suitable for that purpose.
-
Undocumented
Declaration
Swift
public typealias TimeInterval = Foundation.TimeInterval
-
Undocumented
Declaration
Swift
public typealias Time = Date
-
Declaration
Swift
public var now: Date { get }
Return Value
Current time.
-
Singleton instance of
ConcurrentMainScheduler
Declaration
Swift
public static let instance: ConcurrentMainScheduler
-
Schedules an action to be executed immediately.
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).
-
Schedules an action to be executed.
Declaration
Swift
public final func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable
Parameters
state
State passed to the action to be executed.
dueTime
Relative time after which to execute the action.
action
Action to be executed.
Return Value
The disposable object used to cancel the scheduled action (best effort).
-
Schedules a periodic piece of work.
Declaration
Swift
public func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable
Parameters
state
State passed to the action to be executed.
startAfter
Period after which initial work should be run.
period
Period for running the work periodically.
action
Action to be executed.
Return Value
The disposable object used to cancel the scheduled action (best effort).