<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Task/name-swift.type.property",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:ScT12_Concurrencys5NeverORszACRs_rlE4nameSSSgvpZ"
  },
  "title" : "name"
}
-->

# name

Returns the human-readable name of the current task,
if it was set during the tasks’ creation.

```
static var name: String? { get }
```

## Discussion

Tasks can be named during their creation, which can be helpful to identify
unique tasks which may be created at same source locations, for example:

```
func process(items: [Int]) async {
  await withTaskGroup { group in
    for item in items {
      group.addTask(name: "process-\(item)") {
        await process(item)
      }
    }
  }
}
```

### Task name availability

The task name is only available when running with a recent runtime (Swift 6.2+).

[`Task`](/documentation/Swift/Task) initializers which may accept a task name are more available than this property,
for convenience purposes, in order to not have to set task names conditionally
however their effect is runtime dependent, and is reflected in the availability of this property.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)