Schedulers and Threading
Control execution with receive(on:) and subscribe(on:).
Schedulers in Combine
A scheduler in Combine defines when and where work runs — which thread or queue executes the operators and delivers values to subscribers.
Controlling schedulers is essential for keeping UI updates on the main thread and heavy work off it.
Two Key Operators
Combine gives you two operators to control threading:
- subscribe(on:) — controls where the subscription and upstream work begins
- receive(on:) — controls where downstream values are delivered
They affect different ends of the pipeline.
All lessons in this course
- Transforming and Combining Streams
- Schedulers and Threading
- Error Handling Operators
- Custom Publishers and Subscribers