Contents

PHContentEditingInput

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

Declaration

class PHContentEditingInput

Mentioned in

Overview

To edit an asset’s photo or video content:

  1. Fetch a PHAsset object that represents the photo or video to be edited.

  2. Call the asset’s requestContentEditingInput(with:completionHandler:) method to retrieve a PHContentEditingInput object.

  3. 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 PHAdjustmentData object describing the changes.

  4. Initialize a PHContentEditingOutput object. For photo- or video-only assets, use the editing output’s properties to provide edited asset data. For Live Photo assets, create a PHLivePhotoEditingContext object to edit the Live Photo content.

  5. Use a photo library change block to commit the edit. In the block, create a PHAssetChangeRequest object and set its contentEditingOutput property to the editing output that you created. For more details, see PHPhotoLibrary.

You can also edit assets from photo editing extensions. In this case, instead of working with a PHAsset object, you implement methods in the PHContentEditingController protocol. Photos provides a PHContentEditingInput object when your extension begins editing. When editing is complete, Photos requests a PHContentEditingOutput object that contains the edited asset content.

Topics

Getting Information About the Asset

Working with Previous Edits

Working with Photo Assets

Working with Video Assets

Working with Live Photo Assets

Instance Properties

See Also

Editing an Asset