Generic Instance Method


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


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



The maximum number of publishers produced by this method.


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.


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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software