Thanks, now I have a better understanding whether to use RunLoop or DispatchQueue as Scheduler.
I was wondering how people would be able to learn this from the documentation? (Choosing Dispatch Queue or RunLoop)
And It seems like neither extension DispatchQueue: Scheduler { ... }
nor protocol Scheduler { ... }
mentions about the serial queue requirement for Combine's operators.
I tried to use a concurrent queue as the scheduler but there is no warning in the console or crash to help programmers avoid this.
let concurrentQueue = DispatchQueue(label: "ConcurrentQueue", qos: .default, attributes: .concurrent)
Just(10)
.subscribe(on: concurrentQueue)
.map { "\($0)" }
.receive(on: RunLoop.main)
.sink { value in print(value) }