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.

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