<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTAttachment/name",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "c:objc(cs)XCTAttachment(py)name"
  },
  "title" : "name"
}
-->

# name

The attachment’s name, or `nil` if the attachment is unnamed.

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

## Discussion

Set an attachment’s [`name`](/documentation/XCTest/XCTAttachment/name) property to a custom string to provide a descriptive name for the attachment within Xcode’s test reports.

---

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)