Clocks

Section • 2 episodes • 1 hr 34 min

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.

Related content

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.

Schedulers
2 hr 33 min

Where to go from here

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.