A container to which you provide the results of editing the photo, video, or Live Photo content of a Photos asset.
- iOS 8.0+
- macOS 10.11+
- tvOS 10.0+
To edit an asset’s photo or video content:
PHAssetobject that represents the photo or video to be edited.
Call the asset’s
requestmethod to retrieve a
Content Editing Input(with: completion Handler:)
PHContentobject. This object provides information about the asset, the asset data to be edited, and a preview image for display.
Apply your edits to the asset. To allow a user to continue working with the edit later (for example, to adjust the parameters of a photo filter), create a
PHAdjustmentobject describing the changes.
PHContentobject. For photo- or video-only assets, provide the edited content with the
renderedproperty. For Live Photo assets, create a
PHLiveobject to edit the Live Photo content and pass your content editing output to the
Photo Editing Context
Live Photo(to: options: completion Handler:)
For all asset types, provide your adjustment data with the
adjustmentproperty of the content editing output.
Use a photo library change block to commit the edit. (For details, see
PHPhoto.) In the block, create a
PHAssetobject and set its
contentproperty to the editing output that you created.
performcall prompts the user for permission to edit the contents of the photo library—to edit multiple assets in one batch, create multiple
PHAssetobjects within the same change block, each with its own corresponding
You can also edit assets from photo editing extensions. In this case, instead of working with a
PHAsset object, you implement methods in the
PHContent protocol. Photos provides a
PHContent object when your extension begins editing. When editing is complete, Photos requests a
PHContent object that contains the edited asset content.