Executor

public struct Executor

Executor encapsulates asynchrounous way of execution escaped block.

  • Handler that encapsulates asynchrounous way of execution escaped block

    Declaration

    Swift

    public typealias Handler = (@escaping () -> Void) -> Void
  • Initialiaes executor with custom handler

    Declaration

    Swift

    public init(relaxAsyncWhenLaunchingFrom: ObjectIdentifier? = nil, handler: @escaping Handler)

    Parameters

    handler

    encapsulates asynchrounous way of execution escaped block

  • primary executor is primary because it will be used as default value when executor argument is ommited

    Declaration

    Swift

    static let primary: Executor
  • shortcut to the main queue executor

    Declaration

    Swift

    static let main: Executor
  • shortcut to the global concurrent user interactive queue executor

    Declaration

    Swift

    static let userInteractive: Executor
  • shortcut to the global concurrent user initiated queue executor

    Declaration

    Swift

    static let userInitiated: Executor
  • shortcut to the global concurrent default queue executor

    Declaration

    Swift

    static let `default`: Executor
  • shortcut to the global concurrent utility queue executor

    Declaration

    Swift

    static let utility: Executor
  • shortcut to the global concurrent background queue executor

    Declaration

    Swift

    static let background: Executor
  • executes block immediately. Not suitable for long running calculations

    Declaration

    Swift

    static let immediate: Executor
  • initializes executor based on specified queue

    Declaration

    Swift

    static func queue(_ queue: DispatchQueue) -> Executor

    Parameters

    queue

    to execute submitted blocks on

    Return Value

    executor

  • initializes executor based on specified queue

    Declaration

    Swift

    init(queue: DispatchQueue)

    Parameters

    queue

    to execute submitted blocks on

  • initializes executor based on global queue with specified QoS class

    Declaration

    Swift

    static func queue(_ qos: DispatchQoS.QoSClass) -> Executor

    Parameters

    qos

    quality of service for submitted blocks

    Return Value

    executor

  • initializes executor based on global queue with specified QoS class

    Declaration

    Swift

    init(qos: DispatchQoS.QoSClass)

    Parameters

    qos

    quality of service for submitted blocks

  • makes an Executor from OperationQueue

    Declaration

    Swift

    static func operationQueue(
      _ operationQueue: OperationQueue,
      isStrictAsync: Bool = false
      ) -> Executor

    Parameters

    operationQueue

    an OperationQueue to make executor from

    isStrictAsync

    true if the Executor must execute blocks strictly asynchronously. false will relax requirements to increase performance

    Return Value

    constructed Executor

  • initializes an Executor with OperationQueue

    Declaration

    Swift

    init(
      operationQueue: OperationQueue,
      isStrictAsync: Bool = false)

    Parameters

    operationQueue

    an OperationQueue to make executor from

    isStrictAsync

    true if the Executor must execute blocks strictly asynchronously. false will relax requirements to increase performance

    Return Value

    constructed Executor