Swiftology

Articles on advanced Swift topics, functional programming, and software design.

written byAlex Ozun
written with 🧡 and ☕️ by Alex Ozun

Swift Concurrency from Zero to Hero | Reading List

In this short post I want to recommend an ordered reading list that will get you from Zero to Hero in Swift Concurrency.

Each step is progressively and significantly harder than the previous one, and I expect 99% of readers to never reach the end. But those who do are guaranteed to become top 1% subject matter experts.

Disclaimer 0: I only included free and publicly available resources here, so you won't find materials from premium content creators here.

Disclaimer 1: This list is minimal by design. Think of each level as part of the Main Quest, with the expectation that you’ll take dozens of side quests along the way.

Disclaimer 2: It goes without saying that just reading alone won't make you an expert, you'll need to continuously put everything you learn to practice.

Level 0️⃣

Fucking Approachable Swift Concurrency by Pedro PiĂąera Buendia

Easy and fun read with lots of playful analogies, a great introduction to the topic for folks who never dealt with Swift Concurrency before.

(Bonus)

Concurrency on Swift.org

You can't really go wrong with the official Swift Language Guide, but it's a fairly dry read even for a relatively informal "Swift Book" format, but some folks might find this preferable.


Level 1

Concurrency Step-by-Step: series by Matt Massicotte

  1. A Network Request
  2. Reading from Storage
  3. Stateful Systems
  4. Conforming to Protocols

These are practical and example-based guides. But unlike the hundreds of seemingly similar articles you’ll find online, these go beyond simple recipes. They thoughtfully weave in insights and nuggets of wisdom that only a handful of industry veterans like Matt can offer. This is significant, because these tidbits will be coming back to you later in your journey as the dots begin to connect, carrying you to higher planes of understanding when you're ready.

(Bonus)

A Swift Concurrency Glossary

Another helpful resource on Matt’s website succinctly lists and explains each Swift Concurrency keyword and API. While it may be tempting to begin your journey here, I think it’s better to first encounter these concepts naturally in context, and then use this resource as a knowledge checklist and reference.


Level 2

Swift Concurrency Waits for No One by Saagar Jha

Now that you have sufficient vocabulary and user-level understanding of Swift Concurrency, it’s time to go back to the basics and re-conceptualise this knowledge around one of the main principles behind Swift Concurrency’s design - forward progress guarantee. This relatively short article from Saagar packs a lot of punch. And it demands your full attention, with long pauses for pondering and tinkering. Don't hesitate to go on side quests the article might send you, or give it multiple reads until you understand what's written.

(Bonus Video)

Concurrency Hylomorphism by Lucian Radu Teodorecu.

This video has nothing, and yet everything, to do with Swift Concurrency. Lucian demonstrates a prototype language called Hylo that implements a concurrency model similar to Swift Concurrency's. By observing his process, you’ll understand many design principles and underlying implementation details behind Swift Concurrency itself. After all, one of the best ways to understand how something works is to build it yourself, or at least see someone do it.


Level 3

Swift Evolution Proposals

Now, it’s time to put on a Swift language designer hat and read the original Swift Evolution proposals for the concurrency features you’ve been learning so far. Most of them are filled with language designer jargon and are pretty hard to read. You don’t need to understand every single detail, but try to give them your full attention.

But why bother with the proposals when you can just read the official docs? Because at this level, knowing the what and the how isn’t enough. You also need to understand the why behind various concurrency features, the surrounding context, the alternatives that were considered, and the likely future directions. Remember, you’re not the only one on a journey. Swift Concurrency is on a journey of its own, and to be an expert is to be a part of it, even if only as a follower.

Here's the list of heavy-hitters:

Core features:

Actors:

Isolation:

Synchronization:

(Bonus)

Swift Concurrency Manifesto by Chris Lattner

To get an even bigger-picture view and find answers to the Ultimate Why behind Swift Concurrency, it can be useful to read the original Swift Concurrency Manifesto, which dates back to 2017. It's also fun to compare the early vision with the current state of the art.


Level 🦸‍♀️

Swift-Async-Algorithms on GitHub

Wait, what? Are we reading code instead of articles now? Yes, yes we are! We are officially at the "talk is cheap, show me the code" level. So go ahead, check out the repo in Xcode, and start reading and tinkering.

Why swift-async-algorithms?

  • It’s relatively small: at ~12,000 LOC, you can read the entirety of Source/ in a reasonable amount of time (and understanding how Tests/ work is a very interesting side quest, too).
  • High Swift Concurrency density. Almost every type and operation makes some Concurrency-related decision. The library pushes Swift Concurrency to its limits, and in some cases beyond.
  • The core logic is well defined and universal: as long as you know how debounce works, you can skip the parts that encode these rules and focus only on concurrency decisions. You can learn these rules using marble diagrams like those at https://rxmarbles.com.
  • The library is written by people who designed some of Swift Concurrency features, so you're learning from the source (put intended).

Some useful questions to ask when reading the code:

  • Why is this type Sendable?
  • Why does this function have sending arguments / return value?
  • Why is this property nonisolated(unsafe)?
  • Why is an unstructured Task spawned here?
  • Why is UnsafeContinuation or UnsafeTransfer used here?
  • Why is Mutex used here, but Lock used there?
  • How is cancellation handled here?

Final words

I created this reading list mostly based on my personal Swift Concurrency journey. Some of the articles I listed didn’t exist when I started, so I used them as better replacements for what I originally read. I also likely missed some important resources that helped me along the way but slipped my mind. If you have recommendations of your own that fit into one of these levels, please share them in the comments below.