Initializer

init(for:)

Creates a request for modifying the specified collection list.

Declaration

convenience init?(for collectionList: PHCollectionList)

Parameters

collectionList

The collection list to be modified.

Return Value

A collection list change request.

Discussion

After you create a change request within a photo library change block, propose changes to the collection’s title or list of child collections with the properties and instance methods of the change request. After Photos runs your change block, the collection list reflects your changes. For details on change blocks, see PHPhotoLibrary.

Use this method when modifying a collection list’s metadata or when adding or removing child collections without regard to their arrangement. To work with indexes in the list of child collections, use the init(for:childCollections:) method instead.

See Also

Modifying Collection Lists

init?(for: PHCollectionList, childCollections: PHFetchResult<PHCollection>)

Creates a request for modifying the specified collection list, with a fetch result for tracking changes.

var title: String

The displayed name of the collection list.

func addChildCollections(NSFastEnumeration)

Add the specified collections as children of the collection list.

func insertChildCollections(NSFastEnumeration, at: IndexSet)

Inserts the specified collections into the collection list at the specified indexes.

func removeChildCollections(NSFastEnumeration)

Removes the specified child collections from the collection list.

func removeChildCollections(at: IndexSet)

Removes the child collections at the specified indexes from the collection list.

func replaceChildCollections(at: IndexSet, withChildCollections: NSFastEnumeration)

Replaces the child collections at the specified indexes in the collection list with the specified collections.

func moveChildCollections(at: IndexSet, to: Int)

Moves the child collections at the specified indexes in the collection list to a new index.