Class

PHAdjustmentData

A description of the edits made to an asset's photo, video, or Live Photo content, which allows your app to reconstruct or revert the effects of prior editing sessions.

Declaration

class PHAdjustmentData : NSObject

Overview

When a user edits an asset, Photos saves a PHAdjustmentData object along with the modified image or video data. This object provides an application-defined “recipe” you can use to reconstruct the edit. For example, if your app applies filters to a photo, you might might create adjustment data that identifies which filters the user picked, the parameters for each, and the order to apply the filters in. Later, the user can resume working with those filters and parameters by using your app or another app that understands your adjustment data format. When iCloud Photos is enabled, a user can revert or resume edits made on a different device.

You work with adjustment data when editing an asset, using either the requestContentEditingInput(with:completionHandler:) method or a photo extension view controller that implements the PHContentEditingController protocol.

  • When you begin an edit (through a PHContentEditingInput object), examine the editing input’s adjustmentData property to decide whether the last edit made to the asset is compatible with your app. If so, you can allow the user to resume working with that edit. If not, you can make further edits to the last saved version of the photo.

  • When you commit an edit (through a PHContentEditingOutput object), provide a new adjustment whose data represents the changes your app made.

For each asset, Photos stores only one PHAdjustmentData object, representing the most recent edit made to the asset’s content.

Topics

Creating an Adjustment

init(formatIdentifier: String, formatVersion: String, data: Data)

Initializes an adjustment object with the specified format and data.

Identifying the Format of an Adjustment’s Data

var formatIdentifier: String

A string uniquely identifying the format of the adjustment data.

var formatVersion: String

A version number for the adjustment data format.

Reading an Adjustment’s Data

var data: Data

Data that contains the information necessary to reconstruct the adjustment.

Relationships

Inherits From

Conforms To

See Also

Editing an Asset

Editing Asset Content

Make a request to modify and save a photo or video asset.

class PHContentEditingInput

A container that provides information about and access to the image, video, or Live Photo content of an asset to be edited.

class PHContentEditingOutput

A container to which you provide the results of editing the photo, video, or Live Photo content of a Photos asset.

class PHContentEditingInputRequestOptions

A set of options affecting the delivery of image or video data when you request to edit the content of a Photos asset.

class PHLivePhotoEditingContext

An editing session for modifying the photo, video, and audio content of a Live Photo.

protocol PHLivePhotoFrame

A container that provides image content for a single frame of a Live Photo in an editing context.

func canPerform(PHAssetEditOperation) -> Bool

Returns whether the asset supports the specified editing operation.

enum PHAssetEditOperation

Values identifying possible actions an asset can support, used by the canPerform(_:) method.

func cancelContentEditingInputRequest(PHContentEditingInputRequestID)

Cancels a request for editing the asset’s content.

typealias PHContentEditingInputRequestID

An identifier for an asset content editing session.

Editing Request Info Keys

Keys indicating the status of an asset content editing request, used in the completion handler of the requestContentEditingInput(with:completionHandler:) method.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software