Back to Rxswift

ConcurrentDispatchQueueScheduler

docs/Classes/ConcurrentDispatchQueueScheduler.html

6.10.24.2 KB
Original Source

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.

`

                TimeInterval
                `

Undocumented

Declaration

Swift

public typealias TimeInterval = Foundation.TimeInterval

`

                Time
                `

Undocumented

Declaration

Swift

public typealias Time = Date

`

                now
                `

Declaration

Swift

public var now: Date { get }

`

                init(queue:leeway:)
                `

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.

|

`

                init(qos:leeway:)
                `

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.

|

`

                schedule(_:action:)
                `

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

`

                scheduleRelative(_:dueTime:action:)
                `

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

`

                schedulePeriodic(_:startAfter:period:action:)
                `

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