Instance Method


Flattens the stream of events from multiple upstream publishers to appear as if they were coming from a single stream of events.


func switchToLatest() -> Publishers.SwitchToLatest<Prefix.Output, Publishers.Concatenate<Prefix, Suffix>>
Available when Failure is Output.Failure and Output conforms to Publisher.


This operator switches the inner publisher as new ones arrive but keeps the outer one constant for downstream subscribers. For example, given the type Publisher<Publisher<Data, NSError>, Never>, calling switchToLatest() will result in the type Publisher<Data, NSError>. The downstream subscriber sees a continuous stream of values even though they may be coming from different upstream publishers.

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