Home / actors and actor isolation interview
Swift concurrency
Actors and actor isolation interview
Actors are Swift's built-in answer to shared mutable state. Interviews probe whether you understand what isolation actually guarantees and its subtle edges.
What actors guarantee
An actor protects its mutable state by serializing access: only one task runs on the actor at a time, so two tasks cannot mutate its state simultaneously. Access from outside is async and hops onto the actor, which is how the compiler enforces isolation and eliminates data races on that state at compile time.
The edges interviewers probe
The classic trap is reentrancy: an actor can suspend at an await and let another task run, so invariants you assumed held across an await may not. Also discuss nonisolated members for work that touches no actor state, and why passing non-Sendable references into an actor is unsafe. Naming reentrancy unprompted is a strong senior signal.
Go deeper than a summary
Share Your Screen works topics like this through in full: 75 solved Swift problems with tests, 9 real case studies, and 7 annotated mock interviews, so you rehearse the live round instead of just reading about it.
Frequently asked
How is an actor different from a serial queue?
Both serialize access, but an actor is compiler-enforced and integrates with async/await, so isolation violations are caught at compile time rather than by convention.
What is actor reentrancy?
At an await, an actor can suspend and run other tasks before resuming, so state can change across the suspension. You must not assume invariants hold across await points.