Quantcast
Channel: Combine: Asynchronous Programming with Swift - Kodeco Forums
Viewing all articles
Browse latest Browse all 26

[Coombine][Publishers] how to use maxPublishers

$
0
0

not sure the following logic will create three publishers?

[1,2,3].publisher

[1,2,3,4].publisher
.flatMap(maxPublishers: .max(1)) { result in
change(result)
}.sink { result in
print(result)
}.store(in: &subscriptions)

func change(_ num: Int) → AnyPublisher<String, Never> {
Just(String(num)).eraseToAnyPublisher()

}

I still got 1234

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 26

Trending Articles