Type Method

creationRequestForAsset(from:)

Creates a request for adding a new image asset to the Photos library.

Declaration

iOS, Mac Catalyst, tvOS
class func creationRequestForAsset(from image: UIImage) -> Self
macOS
class func creationRequestForAsset(from image: NSImage) -> 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.

See Also

Adding New Assets

class func creationRequestForAssetFromImage(atFileURL: URL) -> Self?

Creates a request for adding a new image asset to the Photos library, using the image file at the specified URL.

class func creationRequestForAssetFromVideo(atFileURL: URL) -> Self?

Creates a request for adding a new video asset to the Photos library, using the video file at the specified URL.

var placeholderForCreatedAsset: PHObjectPlaceholder?

A placeholder object for the asset that the change request creates.