Posts

Post not yet marked as solved
0 Replies
391 Views
I'm learning Combine. I'm trying to understand some behavior when there is concurrent queue applied to receiveOn as a scheduler. I extracted code to present the situation that I'm trying to understand. let queue = DispatchQueue.global() // Or OperationQueue() let subscription = (1...10).publisher .receive(on: queue) .sink { value in print("Received \(value)") } I'm receiving in debug console such output: Received 1 Received 2 Received 3 Received 7 Received 6 But I was expecting 10 lines in the output. Everytime I run it I'm receiving different results but not 10 lines - 10 values. What is happening here? Does anybody know? Where is 4, 5, 8, 9 and 10? Why completion is arriving faster before all values? Is this a combine bug? I was looking in 2 books related to Combine and in apple documentation. No warnings about using concurrent queues as a schedulers in Combine.
Posted
by Kapucha.
Last updated
.