Instance Property

placeholderForCreatedAssetCollection

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

Declaration

var placeholderForCreatedAssetCollection: PHObjectPlaceholder { get }

Discussion

Use this property if you need to reference the asset collection 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 collection and then adds it to a collection list:

PHAssetChangeRequest *createAlbumRequest = [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:@"New Album"];
PHObjectPlaceholder *albumPlaceholder = createAlbumRequest.placeholderForCreatedAssetCollection;
PHCollectionListChangeRequest *folderChangeRequest =
    [PHCollectionListChangeRequest changeRequestForCollectionList:folder];
[folderChangeRequest addChildCollections:@[ albumPlaceholder ]];

For details on change blocks, see PHPhotoLibrary.

See Also

Adding New Asset Collections

class func creationRequestForAssetCollection(withTitle: String) -> Self

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