Transforms all elements from an upstream publisher into a new publisher up to a maximum number of publishers you specify.
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
The maximum number of concurrent publishers subscribed to at once. If not specified, the number of publishers is
A closure that takes an element as a parameter and returns a publisher that produces elements of that type.
A publisher that transforms elements from an upstream publisher into a publisher of that element’s type.
flat operator performs a similar function to the
flat operator in the Swift standard library, but turns the elements from one kind of publisher into a new publisher that is sent to subscribers. Use
flat when you want to create a new series of events for downstream subscribers based on the received value. The closure creates the new
Publisher based on the received value. The new
Publisher can emit more than one event, and successful completion of the new
Publisher does not complete the overall stream. Failure of the new
Publisher will fail the overall stream.
In the example below, a
Weather elements. The
flat receives each element, creates a
URL from it, and produces a new
URLSession, which will publish the data loaded from that