---
title: "init(screenshot:quality:)"
framework: xctest
role: symbol
role_heading: Initializer
path: "xctest/xctattachment/init(screenshot:quality:)"
---

# init(screenshot:quality:)

Creates an attachment containing a representation of the provided screenshot at the requested image quality.

## Declaration

```swift
convenience init(screenshot: XCUIScreenshot, quality: XCTAttachment.ImageQuality)
```

## Parameters

- `screenshot`: The screenshot to wrap as an attachment.
- `quality`: The quality setting to use when storing the screenshot in the attachment.

## Discussion

Discussion Creates an attachment with a uniformTypeIdentifier of "public.png" when quality is XCTAttachment.ImageQuality.original, and a uniformTypeIdentifier of "public.jpeg" when quality is XCTAttachment.ImageQuality.medium or XCTAttachment.ImageQuality.low.

## See Also

### Creating Attachments from Images and Screenshots

- [init(image:)](xctest/xctattachment/init(image:).md)
- [init(image:quality:)](xctest/xctattachment/init(image:quality:).md)
- [init(screenshot:)](xctest/xctattachment/init(screenshot:).md)
- [XCUIScreenshot](xcuiautomation/xcuiscreenshot.md)
- [XCTAttachment.ImageQuality](xctest/xctattachment/imagequality.md)
