Generic Structure

TaskGroup

A group that contains dynamically created child tasks.

Declaration 宣言

@frozen struct TaskGroup<ChildTaskResult> where ChildTaskResult : Sendable

Overview 概要

To create a task group, call the withTaskGroup(of:returning:body:) method. タスクグループを作成するには、withTaskGroup(of:returning:body:)メソッドを呼び出してください。

Don’t use a task group from outside the task where you created it. In most cases, the Swift type system prevents a task group from escaping like that because adding a child task to a task group is a mutating operation, and mutation operations can’t be performed from a concurrent execution context like a child task.

For information about the language-level concurrency model that TaskGroup is part of, see Concurrency in The Swift Programming Language.

Topics 話題

Adding Tasks to a Task Group タスクそれらをあるタスクグループに加える

Accessing Individual Results 個々の結果にアクセスする

Accessing an Asynchronous Sequence of Results 結果それらからなるある非同期シーケンスにアクセスする

Canceling Tasks タスクの取り消し

Supporting Types 支援を行う型

Relationships 関係

Conforms To 次に準拠

See Also 参照

Tasks さまざまなタスク