🎉 Black Friday Sale! Save 30% when you subscribe today.

Concurrency's Future: Tasks and Cooperation

Episode #192 • Jun 13, 2022 • Subscriber-Only

Let’s look at what the future of concurrency looks like in Swift. A recent release of Swift came with a variety of tools with concurrency. Let’s examine its fundamental unit in depth, and explore how they “cooperate” in your applications.

Collection
Threads, queues and tasks
Concurrency's Future: Tasks and Cooperation
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

So, now that we are intimately familiar with what concurrency tools Apple has provided to us in the past and present, let’s look at what the future of concurrency looks like in Swift.

As we all know, Swift 5.5 was released 9 months ago with a variety of tools for concurrency. These tools are in many ways simpler and more robust than the tools we just covered, and they solve a lot of the problems we encountered. Best of all, the tools provide a fully integrated solution to data race conditions, and it’s really amazing to see. Once these features are fully baked in the language you will seldom have to think of asynchrony in terms of threads or reactive streams, and instead you will be able to write code that largely looks the same as if you were working entirely with synchronous processes.

So, let’s repeat the program we have put forth when exploring threads, operation queues and dispatch queues, but this time with a focus on Swift’s modern concurrency tools. These tools are quite a bit different from the threads and queues we previously explored because they are deeply integrated with the language itself, and not just a library built with the language.

Task basics


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