---
title: "moveChildCollections(at:to:)"
framework: photos
role: symbol
role_heading: Instance Method
path: "photos/phcollectionlistchangerequest/movechildcollections(at:to:)"
---

# moveChildCollections(at:to:)

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

## Declaration

```swift
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

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

### Managing Collections

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