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