Topic

Concurrency interview questions

Actors, async/await, isolation, Sendable, data races, and the reasoning behind modern Swift concurrency.

Focus areas: Actors, async/await, isolation, Sendable, and data-race reasoning

What concurrency problems should you know in Swift?

Distinguish race conditions, data races, priority inversion, deadlock, and actor reentrancy anomalies with short Swift examples and practical fixes

On which thread does Swift call deinit?

Explain that deinit runs where the last strong reference is released, then connect that rule to UI safety, MainActor isolation, and isolated deinit

How do you make shared mutable state thread-safe in Swift?

Start with the race condition, then compare locks, semaphores, queues, barriers, and actors for protecting shared mutable state in real Swift code

What's the difference between GCD and OperationQueue?

GCD is Apple's low-level API for scheduling work on dispatch queues. OperationQueue is a higher-level Foundation API that represents work as Operation objects with dependencies, cancellation, priorities, and concurrency limits.

What's the difference between Task, Task.detached, and TaskGroup?

Task creates unstructured work that inherits context, Task.detached creates unstructured work without inheriting context, and a task group creates structured child tasks that the parent awaits together.

What's the difference between DispatchQueue.main.async and .sync?

.async schedules work and returns immediately, while .sync blocks the caller until the work finishes. On the main queue, .async is the normal way to perform UI work, whereas calling .sync from the main thread causes a deadlock.

When would you choose a Swift actor over a serial DispatchQueue?

Compare language-level isolation with traditional queue-based synchronization in production iOS code

How do task groups differ from async let in practical iOS code?

Explain when fixed child tasks make async let the better tool, and when dynamic fan-out or incremental result handling pushes you to task groups