Instance Method

moveChildCollections(at:to:)

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

Declaration

func moveChildCollections(at indexes: IndexSet, to toIndex: Int)

Parameters

indexes

The indexes of the child collections to be moved in the collection list.

toIndex

The index at which to place the moved child collections, relative to the collection list’s ordering after removing the items at indexes.

Discussion

When you call this method, Photos first removes the items in the indexes parameter from the collection, and then inserts them at the location specified by the toIndex parameter.

To ensure that the index set you specify is valid even if the collection list has changed since you fetched it, create a change request with a snapshot of the collection list’s contents using the init(for:childCollections:) method before rearranging child collections.

See Also

Modifying Collection Lists

init?(for: PHCollectionList)

Creates a request for modifying the specified collection list.

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.