ConcurrentDispatchQueueScheduler

public class ConcurrentDispatchQueueScheduler : SchedulerType

Abstracts the work that needs to be performed on a specific dispatch_queue_t. You can also pass a serial dispatch queue, it shouldn’t cause any problems.

This scheduler is suitable when some work needs to be performed in background.

  • Undocumented

    Declaration

    Swift

    public typealias TimeInterval = Foundation.TimeInterval
  • Undocumented

    Declaration

    Swift

    public typealias Time = Date
  • now

    Declaration

    Swift

    public var now: Date { get }
  • Constructs new ConcurrentDispatchQueueScheduler that wraps queue.

    Declaration

    Swift

    public init(queue: DispatchQueue, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0))

    Parameters

    queue

    Target dispatch queue.

    leeway

    The amount of time, in nanoseconds, that the system will defer the timer.

  • Convenience init for scheduler that wraps one of the global concurrent dispatch queues.

    Declaration

    Swift

    public convenience init(qos: DispatchQoS, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0))

    Parameters

    qos

    Target global dispatch queue, by quality of service class.

    leeway

    The amount of time, in nanoseconds, that the system will defer the timer.

  • Schedules an action to be executed immediately.

    Declaration

    Swift

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