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