addTaskUnlessCancelled(executorPreference:priority:operation:)

    Adds a child task to the group and set it up with the passed in task executor preference, unless the group has been canceled.

    iOS
    18.0+
    macOS
    15.0+
    tvOS
    18.0+
    visionOS
    2.0+
    watchOS
    11.0+
    mutating func addTaskUnlessCancelled(executorPreference taskExecutor: (any TaskExecutor)?, priority: TaskPriority? = nil, operation: sending @escaping @isolated(any) () async throws -> Void) -> Bool

    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 invoke addTask() without passing a value to the taskExecutor 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.

    Returns

    true if the child task was added to the group; otherwise false.

    Other members in extension

    Instance members