<!--
{
  "availability" : [
    "Swift: 6.2.0 -",
    "Xcode: 26.0.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: 6.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/Attachment/preferredName",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Swift Testing"
    ],
    "preciseIdentifier" : "s:7Testing10AttachmentVAARi_zrlE13preferredNameSSvp"
  },
  "title" : "preferredName"
}
-->

# preferredName

A filename to use when saving this attachment.

```
var preferredName: String { get }
```

## Discussion

The value of this property is used as a hint to the testing library. The
testing library may substitute a different filename as needed. If the
value of this property has not been explicitly set, the testing library
will attempt to generate its own value.

---

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)