Type Aliasswift 6.1.2_Concurrency
Element
- iOS
- 13.0+
- macOS
- 10.15+
- tvOS
- 13.0+
- watchOS
- 6.0+
typealias Element = ChildTaskResult
typealias Element = ChildTaskResult
import _Concurrency
@frozen struct ThrowingTaskGroup<ChildTaskResult, Failure> where ChildTaskResult : Sendable, Failure : Error
A group that contains throwing, dynamically created child tasks.
protocol Sendable
A thread-safe type whose values can be shared across arbitrary concurrent contexts without introducing a risk of data races. Values of the type may have no shared mutable state, or they may protect that state with a lock or by forcing it to only be accessed from a specific actor.
protocol Error : Sendable
A type representing an error value that can be thrown.
mutating func addTask(executorPreference taskExecutor: (any TaskExecutor)?, priority: TaskPriority? = nil, operation: sending @escaping @isolated(any) () async throws -> ChildTaskResult)
Adds a child task to the group and enqueue it on the specified executor.
mutating func addTaskUnlessCancelled(executorPreference taskExecutor: (any TaskExecutor)?, priority: TaskPriority? = nil, operation: sending @escaping @isolated(any) () async throws -> ChildTaskResult) -> Bool
Adds a child task to the group and enqueue it on the specified executor, unless the group has been canceled.
func makeAsyncIterator() -> ThrowingTaskGroup<ChildTaskResult, Failure>.Iterator
struct Iterator
A type that provides an iteration interface over the results of tasks added to the group.
typealias AsyncIterator = ThrowingTaskGroup<ChildTaskResult, Failure>.Iterator
mutating func add(priority: TaskPriority? = nil, operation: @escaping () async throws -> ChildTaskResult) async -> Bool
mutating func async(priority: TaskPriority? = nil, operation: @escaping () async throws -> ChildTaskResult)
mutating func asyncUnlessCancelled(priority: TaskPriority? = nil, operation: @escaping () async throws -> ChildTaskResult) -> Bool
mutating func spawn(priority: TaskPriority? = nil, operation: @escaping () async throws -> ChildTaskResult)
mutating func spawnUnlessCancelled(priority: TaskPriority? = nil, operation: @escaping () async throws -> ChildTaskResult) -> Bool