🎉 End-of-year Sale! Save 25% when you subscribe today.
The Clock
protocol is the fundamental unit for expressing time-based asynchrony in
Swift. It serves a similar purpose to Combine’s Scheduler
protocol, but is simpler
and more powerful. Understanding this protocol and creating your own conformances can
allow you to take control over time in your applications, rather than letting it control
you.
We previously covered Combine schedulers in depth, including how to erase their types for tests and how to build clocks that allow us to control how time flows through our features’ code.
We now know a lot about concurrency and time-based asynchrony in Swift, but what does it takes to test any of the code we written? Well, sadly it’s a lot harder than we think it should be.