Type Method

attachmentWithImage:

Creates an attachment containing a PNG representation of the provided image.

Declaration

iOS, tvOS
+ (instancetype)attachmentWithImage:(UIImage *)image;
macOS
+ (instancetype)attachmentWithImage:(NSImage *)image;

Parameters

image

The image to wrap as an attachment.

Discussion

Creates an attachment with a uniformTypeIdentifier of "public.png". Equivalent to calling attachmentWithImage:quality: with a quality value of XCTImageQualityOriginal.

See Also

Creating Attachments from Images and Screenshots

+ attachmentWithImage:quality:

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

+ attachmentWithScreenshot:

Creates an attachment containing a PNG representation of the provided screenshot.

+ attachmentWithScreenshot:quality:

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

XCUIScreenshot

A captured image of a screen, app, or UI element state.

XCTImageQuality

Compression quality options for image-based attachments.