Unlock This Episode
Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.
So things are starting to look pretty good. Not only can we use
Effect.task to open up an asynchronous context for our effects, which allows us to perform as many awaits as we want and use a familiar coding style to compute the data that we want to feed back into the system, but we can now also leverage async sleeping in order to introduce delays into our effects.
And best of all, it’s still all testable. Sure we had to insert a little bit of hackiness into our test scheduler, but hopefully Swift will someday introduce tools that allow us to have more control over how work is scheduled in the concurrency runtime.
But there is still a pretty big blind spot in our asynchronous effects story for the Composable Architecture. And that’s effects that need to send multiple actions back into the system.
Effect.task works great for when we have a single action, but what if we need to send many?
It’s totally possible to support this, and in doing so we will be able to greatly simplify many complex effects, and further reduce our reliance on Combine.
Swift has many tools for concurrency, including threads, operation queues, dispatch queues, Combine and now first class tools built directly into the language. We start from the beginning to understand what the past tools excelled at and where they faultered in order to see why the new tools are so incredible.