A Dive Into Actors in Swift 5.5

What are actors, actors re-entrancy, isolation, and using MainActors in Swift with async/await

Neel Bakshi
8 min readJun 17, 2021
Empty bottle in the desert
Photo by Ruud de Peijper on Unsplash.

With the new concurrency-related changes that are coming up with Swift 5.5, the language is making it even easier for us Swift devs to write concurrent code. There is a massive set of proposals that have been accepted into the 5.5 release, and there’s already a ton of new stuff being put out for us to learn and get accustomed to.

One of the new features that is going to come up in the new Swift release is the availability of a new primitive called the actor. So before we start using actors, let’s try to understand what they are and the changes that Swift is bringing forward to support this particular “Actor” model in the language.

The article is therefore going to be broken down into two major sections. In the first section, we will try to understand what actors are, what the underlying problem that they are trying to solve is, and how they solve it. Then we’ll get into how Swift exposes actors to us.

Concurrency and the Actors Model

Concurrency and parallelism in programming are highly effective ways to make sure your program takes advantage of the advances in processor hardware and software to make sure your…

--

--

Neel Bakshi

Guy who handles everything mobile @headout among other things! Ex @practo