<!--
{
  "documentType" : "article",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTAttachment/XCTAttachment-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "XCTAttachment Implementations"
}
-->

# XCTAttachment Implementations

## Topics

### Initializers

[`convenience init(compressedContentsOfDirectoryAtURL: URL)`](/documentation/XCTest/XCTAttachment/init(compressedContentsOfDirectoryAtURL:))

Creates an attachment containing a zipped archive of an existing directory on disk.

[`convenience init(contentsOfFileAtURL: URL)`](/documentation/XCTest/XCTAttachment/init(contentsOfFileAtURL:))

Creates an attachment from the contents of an existing file on disk.

[`convenience init(contentsOfFileAtURL: URL, uniformTypeIdentifier: String)`](/documentation/XCTest/XCTAttachment/init(contentsOfFileAtURL:uniformTypeIdentifier:))

Creates an attachment from the contents of an existing file on disk, with a custom UTI.

---

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)