next

Advances to and returns the result of the next child task.

iOS
13.0+
macOS
10.15+
tvOS
13.0+
watchOS
6.0+
mutating func next() async throws -> ThrowingTaskGroup<ChildTaskResult, Failure>.Iterator.Element?

Returns

The value returned by the next child task that completes, or nil if there are no remaining child tasks,

Throws

The error thrown by the next child task that completes.

The elements returned from this method appear in the order that the tasks completed, not in the order that those tasks were added to the task group. After this method returns nil, this iterator is guaranteed to never produce more values.

For more information about the iteration order and semantics, see ThrowingTaskGroup.next()