---
title: "addTask(name:priority:operation:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/discardingtaskgroup/addtask(name:priority:operation:)"
---

# addTask(name:priority:operation:)

Adds a child task to the group.

## Declaration

```swift
mutating func addTask(name: String?, priority: TaskPriority? = nil, operation: sending @escaping @isolated(any) () async -> Void)
```

## Parameters

- `name`: Human readable name of this task.
- `priority`: The priority of the operation task. Omit this parameter or pass nil to inherit the task group’s base priority.
- `operation`: The operation to execute as part of the task group.
