Publishers.ReplaceEmpty
// Publishers.ReplaceEmpty Publisher
Publishers.ReplaceEmpty(upstream: Publishers.Sequence<[Int], Never>(sequence: []), output: 0)
.sink(receiveCompletion: { completion in
switch completion {
case .failure:
print("Combine ReplaceEmpty Error")
case .finished:
print("Combine ReplaceEmpty Finish")
}
}, receiveValue: { value in
print("Combine ReplaceEmpty : \(value)")
})
.store(in: &cancellables)
// replaceEmpty Operator
Publishers.Sequence<[Int], Never>(sequence: [])
.replaceEmpty(with: 0)
.sink(receiveCompletion: { completion in
switch completion {
case .failure:
print("Combine ReplaceEmpty Error")
case .finished:
print("Combine ReplaceEmpty Finish")
}
}, receiveValue: { value in
print("Combine ReplaceEmpty : \(value)")
})
.store(in: &cancellables)
// Combine ReplaceEmpty : 0
// Combine ReplaceEmpty FinishRxSwift
ReactiveSwift
μ°Έκ³
Last updated