OperationQueueScheduler

public class OperationQueueScheduler : ImmediateSchedulerType

Abstracts the work that needs to be performed on a specific NSOperationQueue.

This scheduler is suitable for cases when there is some bigger chunk of work that needs to be performed in background and you want to fine tune concurrent processing using maxConcurrentOperationCount.

  • Undocumented

    Declaration

    Swift

    public let operationQueue: OperationQueue
  • Undocumented

    Declaration

    Swift

    public let queuePriority: Operation.QueuePriority
  • Constructs new instance of OperationQueueScheduler that performs work on operationQueue.

    Declaration

    Swift

    public init(operationQueue: OperationQueue, queuePriority: Operation.QueuePriority = .normal)

    Parameters

    operationQueue

    Operation queue targeted to perform work on.

    queuePriority

    Queue priority which will be assigned to new operations.

  • Schedules an action to be executed recursively.

    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 execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.

    Return Value

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