creationRequestForAsset(from:)

creationRequestForAsset(from:)

creationRequestForAsset(from:) Type Method of PHAssetChangeRequest Creates a request for adding a new image asset to the Photos library.

class func creationRequestForAsset(from image: UIImage) -> Self

Parameters

image

An image.

Return Value

An asset creation request.

Discussion

Call this method within a photo library change block to create a new asset. For details on change blocks, see PHPhotoLibrary.

To reference the newly created asset later in the same change block or after the change block completes, use the placeholderForCreatedAsset property to retrieve a placeholder object.

Important: A //com.apple.documentation/documentation/UIKit/UIImage object does not contain all metadata associated with the image file it was originally loaded from (for example, Exif tags such as geographic location, camera model, and exposure parameters). To ensure such metadata is saved in the Photos library, instead use the `doc://com.apple.photokit/documentation/Photos/PHAssetChangeRequest/creationRequestForAssetFromImage(atFileURL:) method or the doc://com.apple.photokit/documentation/Photos/PHAssetCreationRequest` class. To copy metadata from one file to another, see //com.apple.documentation/documentation/ImageIO.