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 PHContentEditingInputMentioned in
Overview
To edit an asset’s photo or video content:
Fetch a PHAsset object that represents the photo or video to be edited.
Call the asset’s requestContentEditingInput(with:completionHandler:) method to retrieve a PHContentEditingInput object.
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.
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.
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
Editing Asset ContentPHContentEditingOutputPHAdjustmentDataPHContentEditingInputRequestOptionsPHLivePhotoEditingContextPHLivePhotoFramecanPerform(_:)PHAssetEditOperationrequestContentEditingInput(with:completionHandler:)cancelContentEditingInputRequest(_:)PHContentEditingInputRequestIDEditing Request Info Keys