<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PhotoKit",
  "identifier" : "/documentation/Photos/PHAssetCollectionChangeRequest/moveAssets(at:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Photos"
    ],
    "preciseIdentifier" : "c:objc(cs)PHAssetCollectionChangeRequest(im)moveAssetsAtIndexes:toIndex:"
  },
  "title" : "moveAssets(at:to:)"
}
-->

# moveAssets(at:to:)

Moves the assets at the specified indexes in the asset collection to a new index.

```
func moveAssets(at fromIndexes: IndexSet, to toIndex: Int)
```

## Parameters

`fromIndexes`

The indexes of the assets to be moved in the asset collection.

`toIndex`

The index at which to place the moved assets, relative to the collection’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 asset collection has changed since you fetched it, create a change request with a snapshot of the asset collection’s contents using the [`init(for:assets:)`](/documentation/Photos/PHAssetCollectionChangeRequest/init(for:assets:)) method before rearranging assets.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)