skip to content

Async and Isolation

async and await, structured tasks, async sequences, actors and Sendable checking: the model Swift 6 enforces at compile time. Interviewers ask about isolation and data races.

on this pageshow

explore

questions

page 2 of 2

As a lead on a Swift app, how do you decide which shared state becomes an actor, which stays on the main actor, and which sits behind a `Mutex`?

level: principalimportance: should knowfreq 38%

basics

~20 s

Keep state the UI reads on the main actor; make an actor for shared state whose operations are coarse, asynchronous and used from background work; use a Mutex for small synchronous critical sections that any context must call without await.

open as a page

As iOS lead on a GCD-heavy app adopting Swift 6 language mode, which Dispatch and OperationQueue code would you move to async/await first, and which would you keep?

level: principalimportance: should knowfreq 30%

basics

~20 s

Move first the GCD code that blocks or guards shared state: semaphore and group waits, barrier-protected caches and main-queue hops for UI state. Keep queues an API requires, dispatch sources and working OperationQueue graphs, and wrap them at the boundary.

open as a page

As a lead moving a large Swift codebase to Swift 6 language mode, in what order would you migrate modules, and which shortcuts would you restrict?

level: principalimportance: should knowfreq 45%

basics

~20 s

Migrate module by module, dependencies first: preview Swift 6 errors as warnings with -strict-concurrency=complete in Swift 5 mode, fix them, then switch that module to Swift 6 mode. Use @preconcurrency import as temporary scaffolding and gate @unchecked Sendable and nonisolated(unsafe) behind review.

open as a page

showing 31–33 of 33