<!--
{
  "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/AttachableWrapper",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Swift Testing"
    ],
    "preciseIdentifier" : "s:7Testing17AttachableWrapperP"
  },
  "title" : "AttachableWrapper"
}
-->

# AttachableWrapper

A protocol describing a type whose instances can be recorded and saved as
part of a test run and which contains another value that it stands in for.

```
protocol AttachableWrapper<Wrapped> : Attachable, ~Copyable
```

## Overview

To attach an attachable value to a test, pass it to [`record(_:named:sourceLocation:)`](/documentation/Testing/Attachment/record(_:named:sourceLocation:)).
To further configure an attachable value before you attach it, use it to
initialize an instance of [`Attachment`](/documentation/Testing/Attachment) and set its properties before
passing it to [`record(_:sourceLocation:)`](/documentation/Testing/Attachment/record(_:sourceLocation:)). An attachable
value can only be attached to a test once.

A type can conform to this protocol if it represents another type that
cannot directly conform to [`Attachable`](/documentation/Testing/Attachable), such as a non-final class or a
type declared in a third-party module.

## Topics

### Associated Types

[`associatedtype Wrapped`](/documentation/Testing/AttachableWrapper/Wrapped)

The type of the underlying value represented by this type.

### Instance Properties

[`var wrappedValue: Self.Wrapped`](/documentation/Testing/AttachableWrapper/wrappedValue)

The underlying value represented by this instance.

## Relationships

### Inherits From

[`Attachable`](/documentation/Testing/Attachable)

---

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)