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