withTaskGroup
Asked on 2026-05-03
3 searches
The concept of withTaskGroup is discussed in the session titled "Code-along: Elevate an app with Swift concurrency" from WWDC 2025. Task Groups provide fine-grained control over child tasks and their results, allowing you to kick off any number of child tasks that can run in parallel. Each child task can take arbitrary amounts of time to finish, and they might complete in a different order. Task Groups conform to async sequences, enabling iteration over results as they complete.
For more detailed information, you can refer to the session chapter on "Controlling asynchronous code with structured concurrency" in the Code-along: Elevate an app with Swift concurrency (27:56) session.

Code-along: Elevate an app with Swift concurrency
Learn how to optimize your app’s user experience with Swift concurrency as we update an existing sample app. We’ll start with a main-actor app, then gradually introduce asynchronous code as we need to. We’ll use tasks to optimize code running on the main actor, and discover how to parallelize code by offloading work to the background. We’ll explore what data-race safety provides, and work through interpreting and fixing data-race safety errors. Finally, we’ll show how you can make the most out of structured concurrency in the context of an app.

What’s new in Xcode
Discover the latest productivity and performance advancements in Xcode 26. Learn how to leverage large language models in your development workflow. Explore editing and debugging enhancements, improved performance and testing tools, and Swift Build - the open-source build system engine used by Xcode.

Finish tasks in the background
Discover background execution advancements and understand how the system schedules runtime. We’ll discuss how to get the most out of background runtime to allow your app to deliver features in the background while maintaining a great foreground experience. We’ll also cover how APIs provide background runtime for your app, and how each API is tailored for different use cases — including new APIs in iOS and iPadOS 26 that let your app finish tasks as your app transitions from the foreground to the background.
