Transforms all elements from an upstream publisher into a new or existing publisher.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Framework
- Combine
Declaration
func flatMap<T, P>(maxPublishers: Subscribers.Demand = .unlimited, _ transform: @escaping ((A.Output, B.Output, C.Output)) -> P) -> Publishers.Flat Map<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
flat
merges the output from all returned publishers into a single stream of output.