Publishers.DropUntilOutput
let sourceSubject = PassthroughSubject<Int, Never>()
let otherSubject = PassthroughSubject<Int, Never>()
// Publishers.DropUntilOutput Publisher
Publishers
.DropUntilOutput(upstream: sourceSubject, other: otherSubject)
.sink(receiveCompletion: { completion in
switch completion {
case .failure:
print("Combine DropUntilOutput Error")
case .finished:
print("Combine DropUntilOutput Finish")
}
}, receiveValue: { value in
print("Combine DropUntilOutput : \(value)")
})
.store(in: &cancellables)
// drop Operator
sourceSubject
.drop(untilOutputFrom: otherSubject)
.sink(receiveCompletion: { completion in
switch completion {
case .failure:
print("Combine DropUntilOutput Error")
case .finished:
print("Combine DropUntilOutput Finish")
}
}, receiveValue: { value in
print("Combine DropUntilOutput : \(value)")
})
.store(in: &cancellables)
// 1
sourceSubject.send(1)
// 2
otherSubject.send(2)
// 3
sourceSubject.send(3)
// Combine DropUntilOutput : 3RxSwift
ReactiveSwift
μ°Έκ³
Last updated