What is structured concurrency?
The essence
Structured concurrency is the principle that child tasks live no longer than the scope that created them. A parent function cannot return until all of its child tasks have finished, thrown or been cancelled. Tasks form a tree, and cancellation, errors and priority propagate automatically along it. In Swift the structured constructs are async let and withTaskGroup / withThrowingTaskGroup / withDiscardingTaskGroup. The unstructured ones are Task { } and Task.detached { }: their lifetime is tied to nothing.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep