Daily iOS
Concurrency

Composing dependent work

You have independent pieces of work A, B, and C. C must run only after both A and B have finished, the order of A and B doesn't matter, and they don't nest inside each other. Tell me every way you know to implement that, with the pros and cons.

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

DispatchGroup notify, concurrent queue plus barrier, DispatchSemaphore wait twice (blocking), OperationQueue addDependency, Swift Concurrency async let/TaskGroup. New code uses async let, legacy uses a group, and semaphores are banned on main.

Share a question