what is Actor?
Asked on 2025-09-01
1 search
In Swift, an "actor" is a reference type similar to a class, designed to encapsulate shared mutable state while automatically protecting that state by serializing accesses. This means that only a single task can execute at a time on an actor, and calls to actor methods from outside the context of the actor are asynchronous. Actors help in managing concurrency by isolating their data, ensuring that only one thread can access the data at a time, which helps prevent data races.
Actors are particularly useful when you want to move some state from the main actor to a background thread, allowing more code to execute without blocking the main thread, thus keeping the UI responsive. You can define your own actor types, and unlike the main actor, there can be many actor objects in a program, each independent and not tied to a single thread.
For more detailed information, you can refer to the session Embracing Swift concurrency (23:18) from WWDC 2025.

Embracing Swift concurrency
Join us to learn the core Swift concurrency concepts. Concurrency helps you improve app responsiveness and performance, and Swift is designed to make asynchronous and concurrent code easier to write correctly. We’ll cover the steps you need to take an app through from single-threaded to concurrent. We’ll also help you determine how and when to make the best use of Swift concurrency features – whether it’s making your code more asynchronous, moving it to the background, or sharing data across concurrent tasks.

A Swift Tour: Explore Swift’s features and design
Learn the essential features and design philosophy of the Swift programming language. We’ll explore how to model data, handle errors, use protocols, write concurrent code, and more while building up a Swift package that has a library, an HTTP server, and a command line client. Whether you’re just beginning your Swift journey or have been with us from the start, this talk will help you get the most out of the language.

Migrate your app to Swift 6
Experience Swift 6 migration in action as we update an existing sample app. Learn how to migrate incrementally, module by module, and how the compiler helps you identify code that’s at risk of data races. Discover different techniques for ensuring clear isolation boundaries and eliminating concurrent access to shared mutable state.