class vs actor
In Swift, what's the difference between a class and an actor?
In Swift, what's the difference between a class and an actor?
An actor is a reference type whose access to mutable state is serialized automatically, an isolation domain: from outside you can only reach it with await, and the compiler checks that. A class has no such guarantee, so you have to use locks yourself and the compiler doesn't know when you get it wrong.
ConcurrencyShort answerIntro
A new iOS feature needs a network result shared across several screens, and the UI has to…
#actor #mainactor #swift-concurrency
ConcurrencyShort answerExpert
This image cache actor built with Swift Concurrency sometimes sends two network requests…
#actor #isolation
ConcurrencyShort answerAdvanced
In Swift Concurrency, what's the difference between putting @MainActor on a whole view…
#mainactor #isolation
TestingShort answerExpert
How do you reproduce or detect a data race in concurrent code that uses actors and Tasks?
#actor #swift-concurrency