Instance Method

replaceEmpty(with:)

Replaces an empty stream with the provided element.

Declaration

func replaceEmpty(with output: Upstream.Output) -> Publishers.ReplaceEmpty<Publishers.Multicast<Upstream, SubjectType>>

Parameters

output

An element to emit when the upstream publisher finishes without emitting any elements.

Return Value

A publisher that replaces an empty stream with the provided output element.

Discussion

If the upstream publisher finishes without producing any elements, this publisher emits the provided element, then finishes normally.