Generic Instance Method

flatMap(maxPublishers:_:)

Transforms all elements from an upstream publisher into a new or existing publisher.

Declaration

func flatMap<T, P>(maxPublishers: Subscribers.Demand = .unlimited, _ transform: @escaping ((A.Output, B.Output, C.Output)) -> P) -> Publishers.FlatMap<P, Publishers.Zip3<A, B, C>> where T == P.Output, P : Publisher, Self.Failure == P.Failure

Parameters

maxPublishers

The maximum number of publishers produced by this method.

transform

A closure that takes an element as a parameter and returns a publisher that produces elements of that type.

Return Value

A publisher that transforms elements from an upstream publisher into a publisher of that element’s type.

Discussion

flatMap merges the output from all returned publishers into a single stream of output.