Daily iOS
Concurrency

Choosing concurrency tools

A new iOS feature needs a network result shared across several screens, and the UI has to update too. What role would you give each of Swift Concurrency's async/await, Task, and actor?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

An async function is the syntax for writing waiting work like networking in order, a Task is the entry point from synchronous code (a button tap, viewDidLoad) into that async world, and an actor wraps mutable state that several Tasks touch together, like a response cache, and serializes access. UI updates happen in a ViewModel isolated to @MainActor.

Share a question