Instance Methodswift 6.0.1_Concurrency
addTask(executorPreference:priority:operation:)
Adds a child task to the group and set it up with the passed in task executor preference.
- iOS
- 18.0+
- macOS
- 15.0+
- tvOS
- 18.0+
- visionOS
- 2.0+
- watchOS
- 11.0+
mutating func addTask(executorPreference taskExecutor: (any TaskExecutor)?, priority: TaskPriority? = nil, operation: sending @escaping @isolated(any) () async throws -> Void)
Parameters
- taskExecutor
The task executor that the child task should be started on and keep using. If
nil
is passed explicitly, tht parent task’s executor preference (if any), will be ignored. In order to inherit the parent task’s executor preference invokeaddTask()
without passing a value to thetaskExecutor
parameter, and it will be inherited automatically.- priority
The priority of the operation task. Omit this parameter or pass
.unspecified
to set the child task’s priority to the priority of the group.- operation
The operation to execute as part of the task group.
Other members in extension
Instance members
func addTaskUnlessCancelled(executorPreference: (any TaskExecutor)?, priority: TaskPriority?, operation: sending
Adds a child task to the group and set it up with the passed in task executor preference, unless the group has been canceled.