Replaces an empty stream with the provided element.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Framework
- Combine
Declaration
func replaceEmpty(with output: Output) -> Publishers.Replace Empty<Publishers.Map<Upstream, Output>>
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.