Swift concurrency interview questions

async/await, tasks, actors, Sendable and the Swift 6.2 defaults, plus the GCD questions interviewers still ask.

6 quick facts

– interview-ready · 17 questions in this topic

– of 17 tried

Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.

Questions

  1. Sequential await vs async letPredict · timeline
  2. async/await vs completion handlersPick the fix
  3. async let vs TaskGroupPick the fix · timeline
  4. Cooperative cancellationPredict · timeline
  5. Task {} vs Task.detachedPick the fix
  6. What is an actor?Pick the fix
  7. Actor reentrancy: check, await, then actPredict · timeline
  8. @MainActor view modelsSpot the bug
  1. Sendable and Swift 6 strict checkingPick the fix
  2. Swift 6.2: default MainActor and @concurrentPredict
  3. Mutex vs actorPick the fix
  4. Serial vs concurrent queuesPredict
  5. DispatchQueue.main.sync on the main threadPredict
  6. Reader-writer with a barrier vs an actorSpot the bug
  7. Bridging callbacks with AsyncStreamPredict
  8. OperationQueue vs GCDPick the fix
  9. Single-flight token refreshPick the fix

Practise this topic

Flashcards · 23

Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.

Quick quiz · 17 questions

One exercise per question, checked as you go. Needs JavaScript.

Mock interview · 3 sets

Timed, out loud, then tick what you covered. Needs JavaScript.

Fix this PR · 2 reviews

Review a diff like a senior: flag the lines you'd comment on. Needs JavaScript.

Quick facts

Recall the answer first, then tap Show to check.