<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/demystifying-concurrency-in-swift-when-to-use-structured-vs-unstructured-tasks-ghkryqqps" -->

---
title: Demystifying Concurrency in Swift: When to Use...
description: Explains the difference between structured and unstructured concurrency in Swift, covering async let and TaskGroup for scoped, cancellation-aware parallel...
canonical: https://daily.dev/posts/demystifying-concurrency-in-swift-when-to-use-structured-vs-unstructured-tasks-ghkryqqps
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Demystifying Concurrency in Swift: When to Use Structured vs. Unstructured Tasks | daily.dev
og:description: Explains the difference between structured and unstructured concurrency in Swift, covering async let and TaskGroup for scoped, cancellation-aware parallel...
og:url: https://daily.dev/posts/demystifying-concurrency-in-swift-when-to-use-structured-vs-unstructured-tasks-ghkryqqps
og:image: https://api.daily.dev/og/posts/ghKryQQps.png
og:image:alt: Demystifying Concurrency in Swift: When to Use Structured vs. Unstructured Tasks
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Demystifying Concurrency in Swift: When to Use Structured vs. Unstructured Tasks

**[Medium](https://daily.dev/sources/medium_js)** · 3 min read · 0 upvotes · 0 comments

## Summary

Explains the difference between structured and unstructured concurrency in Swift, covering async let and TaskGroup for scoped, cancellation-aware parallel operations, versus Task and Task.detached for fire-and-forget or UI-triggered async work. Includes code examples for fetching dashboard data with withThrowingTaskGroup and bridging a synchronous SwiftUI button action into an async task. Ends with the author's job-seeking pitch and links to portfolio, LinkedIn, and a Telegram channel.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@kost9klinov/demystifying-concurrency-in-swift-when-to-use-structured-vs-unstructured-tasks-f51f606f4b5d>

## Questions this post answers

### When should I use TaskGroup instead of an unstructured Task in Swift?

Use TaskGroup or async let when child tasks should be scoped to a parent's lifetime, such as fetching a user profile, posts, and notifications concurrently before rendering a screen. TaskGroup automatically propagates cancellation to all children and cancels remaining tasks if one throws, making it suited to dependent parallel operations with automatic error containment.

_Developers deciding between Swift concurrency patterns can find more comparisons like this on daily.dev._

### Why doesn't my Task { } inherit cancellation from its parent in Swift?

Task { ... } and Task.detached { ... } create unstructured tasks that do not inherit a parent task's lifetime or automatic cancellation hierarchy by default, unless spawned from an actor context where they inherit isolation. They run independently of the scope that created them, which makes them suited for fire-and-forget work like analytics logging or background syncing.

_Track subtle async/await gotchas like this by following Swift concurrency discussions on daily.dev._

## Similar posts on daily.dev

- [Swift Concurrency Fundamentals \#4: Task, Cancellation, and TaskGroup](https://daily.dev/posts/swift-concurrency-fundamentals-4-task-cancellation-and-taskgroup-2taj1mey4) · Medium · 0 upvotes · 0 comments
- [Swift Concurrency is Gaining Broader Adoption -- Fatbobman's Swift Weekly \#133](https://daily.dev/posts/swift-concurrency-is-gaining-broader-adoption----fatbobman-s-swift-weekly-133-40hcoackj) · Fatbobman · 0 upvotes · 0 comments

---

Tags: [#ios](https://daily.dev/tags/ios), [#swift](https://daily.dev/tags/swift)

[View this post on daily.dev](https://daily.dev/posts/demystifying-concurrency-in-swift-when-to-use-structured-vs-unstructured-tasks-ghkryqqps)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Demystifying Concurrency in Swift: When to Use Structured vs. Unstructured Tasks","url":"https://daily.dev/posts/demystifying-concurrency-in-swift-when-to-use-structured-vs-unstructured-tasks-ghkryqqps","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/demystifying-concurrency-in-swift-when-to-use-structured-vs-unstructured-tasks-ghkryqqps"},"datePublished":"2026-09-14T06:16:11.099Z","dateModified":"2026-09-14T06:23:53.233Z","description":"Explains the difference between structured and unstructured concurrency in Swift, covering async let and TaskGroup for scoped, cancellation-aware parallel...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/demystifying-concurrency-in-swift-when-to-use-structured-vs-unstructured-tasks-ghkryqqps","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ios,swift","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Demystifying Concurrency in Swift: When to Use Structured vs. Unstructured Tasks"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/demystifying-concurrency-in-swift-when-to-use-structured-vs-unstructured-tasks-ghkryqqps#faq","mainEntity":[{"@type":"Question","name":"When should I use TaskGroup instead of an unstructured Task in Swift?","acceptedAnswer":{"@type":"Answer","text":"Use TaskGroup or async let when child tasks should be scoped to a parent's lifetime, such as fetching a user profile, posts, and notifications concurrently before rendering a screen. TaskGroup automatically propagates cancellation to all children and cancels remaining tasks if one throws, making it suited to dependent parallel operations with automatic error containment. Developers deciding between Swift concurrency patterns can find more comparisons like this on daily.dev."}},{"@type":"Question","name":"Why doesn't my Task { } inherit cancellation from its parent in Swift?","acceptedAnswer":{"@type":"Answer","text":"Task { ... } and Task.detached { ... } create unstructured tasks that do not inherit a parent task's lifetime or automatic cancellation hierarchy by default, unless spawned from an actor context where they inherit isolation. They run independently of the scope that created them, which makes them suited for fire-and-forget work like analytics logging or background syncing. Track subtle async/await gotchas like this by following Swift concurrency discussions on daily.dev."}}]}
```

