Instance Method

replaceError(with:)

Replaces any errors in the stream with the provided element.

Declaration

func replaceError(with output: Upstream.Output) -> Publishers.ReplaceError<Publishers.Share<Upstream>>

Parameters

output

An element to emit when the upstream publisher fails.

Return Value

A publisher that replaces an error from the upstream publisher with the provided output element.

Discussion

If the upstream publisher fails with an error, this publisher emits the provided element, then finishes normally.

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