Instance Method

insertChildCollections(_:at:)

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

Declaration

func insertChildCollections(_ collections: NSFastEnumeration, at indexes: IndexSet)

Parameters

collections

An array of PHCollection objects (asset collections or other collection lists) to be inserted into the collection list.

indexes

The indexes at which the collections should be inserted. The count of locations in this index set must equal the count of collections.

Discussion

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 inserting child collections.

For a detailed discussion of how the index set you specify maps to insertions in the collection list, see the similar NSMutableArray method insert(_:at:).

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 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.