A request to create, delete, change metadata for, or edit the content of a Photos asset, for use in a photo library change block.
- iOS 8+
- macOS 10.15+Beta
- UIKit for Mac 13.0+Beta
- tvOS 10+
You use the
PHAsset class to request changes for
PHAsset objects. To make changes to assets in the Photos library, create a change request by using the appropriate class method for the change you want to perform.
Call one of the methods listed in Adding New Assets to create a new asset from an image or video file.
deletemethod to delete existing assets.
init(for:)method to modify an asset’s content or metadata.
A change request for creating or modifying an asset works like a mutable version of the asset object. Use the change request’s properties to request changes to the corresponding properties of the asset itself. For example, the following code uses the
is property of a change request to mark an asset as a favorite:
After Photos runs the change block and calls your completion handler, the asset’s state reflects the changes that you requested in the block.
If you create or use a change request object outside a photo library change block, Photos raises an Objective-C exception. For details on change blocks, see