Instance Property

placeholderForCreatedAsset

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

Declaration

var placeholderForCreatedAsset: PHObjectPlaceholder? { get }

Discussion

Use this property if you need to reference the asset created by a change request within the same change block. For example, the following code, when included in a photo library change block, creates an asset and then adds it to a collection:

PHAssetChangeRequest *createAssetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:image];
PHObjectPlaceholder *assetPlaceholder = createAssetRequest.placeholderForCreatedAsset;
PHAssetCollectionChangeRequest *albumChangeRequest =
    [PHAssetCollectionChangeRequest changeRequestForAssetCollection:album];
[albumChangeRequest addAssets:@[ assetPlaceholder ]];

For details on change blocks, see PHPhotoLibrary.

See Also

Adding New Assets

class func creationRequestForAsset(from: UIImage) -> Self

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

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.