---
title: "insertChildCollections(_:at:)"
framework: photos
role: symbol
role_heading: Instance Method
path: "photos/phcollectionlistchangerequest/insertchildcollections(_:at:)"
---

# insertChildCollections(_:at:)

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

## Declaration

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

## Parameters

- `collections`: An array of doc://com.apple.photokit/documentation/Photos/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

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.

## See Also

### Managing Collections

- [addChildCollections(_:)](photos/phcollectionlistchangerequest/addchildcollections(_:).md)
- [moveChildCollections(at:to:)](photos/phcollectionlistchangerequest/movechildcollections(at:to:).md)
- [replaceChildCollections(at:withChildCollections:)](photos/phcollectionlistchangerequest/replacechildcollections(at:withchildcollections:).md)
- [removeChildCollections(_:)](photos/phcollectionlistchangerequest/removechildcollections(_:).md)
- [removeChildCollections(at:)](photos/phcollectionlistchangerequest/removechildcollections(at:).md)
