Initializer

init(for:)

Creates a request for modifying the specified asset.

Declaration

convenience init(for asset: PHAsset)

Parameters

asset

The asset to be modified.

Return Value

An asset change request.

Discussion

Before editing an asset, use its canPerform(_:) method to see if the asset allows editing.

After you create a change request within a photo library change block, propose changes to the original asset’s properties by setting the corresponding properties of the change request. After Photos runs your change block, the asset’s properties reflect your changes. For details on change blocks, see PHPhotoLibrary.

To edit an asset’s image or video content, first begin a content editing session with the asset’s requestContentEditingInput(with:completionHandler:) method. You commit a content edit by setting the contentEditingOutput property of a change request within a change block. For more information about asset content editing, see PHAsset.

See Also

Modifying Assets

var creationDate: Date?

The date and time at which the asset claims to have been originally created.

var location: CLLocation?

The location information saved with the asset.

var isFavorite: Bool

A Boolean value that indicates whether the asset is marked as one of the user’s favorites.

var isHidden: Bool

A Boolean value that indicates whether the asset is hidden in collections.

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