<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTAttachment/init(plistObject:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "c:objc(cs)XCTAttachment(cm)attachmentWithPlistObject:"
  },
  "title" : "init(plistObject:)"
}
-->

# init(plistObject:)

Creates an attachment from an object that can be represented in an XML property list.

```
convenience init(plistObject object: Any)
```

## Parameters

`object`

An object that can be serialized to an XML property list format, such as an array, dictionary, string, or date.

## Discussion

The content of the attachment is an XML property list representation of the provided object with a [`uniformTypeIdentifier`](/documentation/XCTest/XCTAttachment/uniformTypeIdentifier) value of `"com.apple.xml-property-list"`.

> Note:
> Creating an attachment with a non-property-list-compatible object will trigger an exception at the point that the attachment is added to an ``doc://com.apple.xctest/documentation/XCTest/XCTActivity``.

---

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)