Combine Schedulers: Controlling Time

Episode #105 • Jun 8, 2020 • Subscriber-Only

The Scheduler protocol of Combine is a powerful abstraction that unifies many ways of executing asynchronous work, and it can even control the flow of time through our code. Unfortunately Combine doesn’t give us this ability out of the box, so let’s build it from scratch.

Previous episode
Combine Schedulers: Controlling Time
Next episode
Locked

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Sign in with GitHub

Introduction

This just doesn’t seem to be very dependable. I wouldn’t want to depend on this test suite where first there’s magical constants being used to determine how long to wait, and second the test suite could randomly fail for no fault of our own. This creates an environment of not trusting our test suite.

Luckily Combine gives us a tool for handling this. The crux of the problem is that we used DispatchQueue.main when telling our publishers what queue to receive values on and when describing how to debounce values.

The Scheduler protocol


References

Downloads

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 64 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing