var isEmpty : Bool
func waitForAll ()
Availability
Technology
mutating func next() async -> ChildTaskResult ?
The value returned by the next child task that completes. 完了した次の子タスクによって返された値。
The values returned by successive calls to this method appear in the order that the tasks completed, not in the order that those tasks were added to the task group. For example: このメソッドへの連続した呼び出しによって返される値それらは、タスクそれらが完了した順に現れます、タスクがタスクグループに加えられた順にではなく。例えば:
If there aren’t any pending tasks in the task group, this method returns nil
, which lets you write the following to wait for a single task to complete:
何ら未解決タスクがタスクグループの中にないならば、このメソッドはnil
を返します、それはあなたにある単一のタスクが完了するのを待つ以下を書かせます:
It also lets you write code like the following to wait for all the child tasks to complete, collecting the values they returned:
Awaiting on an empty group immediate returns nil
without suspending.
空グループに対して待つことは、中断することなくnil
を直ぐに返します。
You can also use a for
-await
-in
loop to collect results of a task group:
Don’t call this method from outside the task where you created this task group. In most cases, the Swift type system prevents this mistake. For example, because the add(priority:
method is mutating, that method can’t be called from a concurrent execution context like a child task.
var isEmpty : Bool
func waitForAll ()