Bird
0
0

What is the primary role of a TaskGroup in Swift concurrency?

easy📝 Conceptual Q1 of 15
iOS Swift - Concurrency
What is the primary role of a TaskGroup in Swift concurrency?
ATo create a single synchronous task
BTo handle UI updates on the main thread
CTo manage a group of related asynchronous tasks and wait for all to complete
DTo schedule tasks on a background thread only
Step-by-Step Solution
Solution:
  1. Step 1: Understand TaskGroup purpose

    A TaskGroup is designed to manage multiple asynchronous tasks together.
  2. Step 2: Identify correct usage

    It allows waiting for all tasks in the group to finish before continuing.
  3. Final Answer:

    To manage a group of related asynchronous tasks and wait for all to complete -> Option C
  4. Quick Check:

    TaskGroup purpose = Manage related async tasks [OK]
Quick Trick: TaskGroup waits for all child tasks to finish before continuing [OK]
Common Mistakes:
  • Confusing TaskGroup with a single Task
  • Thinking TaskGroup runs tasks synchronously
  • Assuming TaskGroup only schedules on background threads

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes