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 ((Output0, Output1)) -> P) -> Publishers.FlatMap<P, Publishers.MapKeyPath2<Upstream, Output0, Output1>> 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.