Sequence

protocol Sequence
  • Asyncronously transforms each element of the Sequence with a transform that returns Completing.

    Declaration

    Swift

    func asyncFlatMap<T: Completing>(
      executor: Executor = .primary,
      _ transform: @escaping (_ element: Self.Iterator.Element) throws -> T
      ) -> Future<[T.Success]>

    Parameters

    executor

    to perform transform on

    transform

    transformation to perform

    element

    to transform

    Return Value

    a Future of Array of results

  • Asyncronously transforms each element of the Sequence with a transform that returns Completing.

    Declaration

    Swift

    func asyncFlatMap<T: Completing, C: ExecutionContext>(
      context: C,
      executor: Executor? = nil,
      _ transform: @escaping (_ strongContext: C, _ element: Self.Iterator.Element) throws -> T
      ) -> Future<[T.Success]>

    Parameters

    context

    ExectionContext to apply transformation in

    executor

    override of ExecutionContexts executor. Keep default value of the argument unless you need to override an executor provided by the context

    transform

    transformation to perform

    element

    to transform

    Return Value

    a Future of Array of results

  • joins a Sequence of Completing to a Future of Array

    Declaration

    Swift

    func joined() -> Future<[Self.Iterator.Element.Success]>
  • Asyncronously transforms each element of the Sequence

    Declaration

    Swift

    func asyncMap<T>(
      executor: Executor = .primary,
      _ transform: @escaping (_ element: Self.Iterator.Element) throws -> T
      ) -> Future<[T]>

    Parameters

    executor

    to perform transform on

    transform

    transformation to perform

    element

    to transform

    Return Value

    a Future of Array of results

  • Asyncronously transforms each element of the Sequence

    Declaration

    Swift

    func asyncMap<T, C: ExecutionContext>(
      context: C,
      executor: Executor? = nil,
      _ transform: @escaping (_ strongContext: C, _ element: Self.Iterator.Element) throws -> T
      ) -> Future<[T]>

    Parameters

    context

    ExectionContext to apply transformation in

    executor

    override of ExecutionContexts executor. Keep default value of the argument unless you need to override an executor provided by the context

    transform

    transformation to perform

    element

    to transform

    Return Value

    a Future of Array of results

  • internal use only**

    Declaration

    Swift

    func _asyncMap<T>(
      executor: Executor = .primary,
      _ transform: @escaping (_ element: Self.Iterator.Element) throws -> T
      ) -> Promise<[T]>
  • Asyncronously reduces over each element of the Sequence of Completing

    Declaration

    Swift

    func asyncReduce<T>(
      _ initialResult: T,
      executor: Executor = .primary,
      _ nextPartialResult: @escaping (_ accumulator: T, _ element: Self.Iterator.Element.Success) throws -> T
      ) -> Future<T>

    Parameters

    executor

    to perform transform on

    nextPartialResult

    function to reduce with

    element

    to transform

    Return Value

    a Future of Array of results

  • Asyncronously reduces over each element of the Sequence of Completing

    Declaration

    Swift

    func asyncReduce<T, C: ExecutionContext>(
      _ initialResult: T,
      context: C,
      executor: Executor? = nil,
      // swiftlint:disable:next line_length
      _ nextPartialResult: @escaping (_ strongContext: C, _ accumulator: T, _ element: Self.Iterator.Element.Success) throws -> T
      ) -> Future<T>

    Parameters

    context

    ExectionContext to apply transformation in

    executor

    override of ExecutionContexts executor. Keep default value of the argument unless you need to override an executor provided by the context

    nextPartialResult

    function to reduce with

    element

    to transform

    Return Value

    a Future of Array of results