<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PhotoKit",
  "identifier" : "/documentation/Photos/PHFetchResultChangeDetails/enumerateMoves(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Photos"
    ],
    "preciseIdentifier" : "c:objc(cs)PHFetchResultChangeDetails(im)enumerateMovesWithBlock:"
  },
  "title" : "enumerateMoves(_:)"
}
-->

# enumerateMoves(_:)

Runs the specified block for each case where an object has moved from one index to another in the fetch result.

```
func enumerateMoves(_ handler: @escaping (Int, Int) -> Void)
```

## Parameters

`handler`

A block that Photos calls to provide details about which objects in the fetch result have moved to which indexes.

    The block takes the following parameters:

- fromIndex: The index of an object in the original fetch result.
- toIndex: The index to which the object has moved in the new fetch result.

## Discussion

The `toIndex` parameter in the `handler` block is relative to the state of the fetch result after you’ve applied the changes described by the [`removedIndexes`](/documentation/Photos/PHFetchResultChangeDetails/removedIndexes), [`insertedIndexes`](/documentation/Photos/PHFetchResultChangeDetails/insertedIndexes) and [`changedIndexes`](/documentation/Photos/PHFetchResultChangeDetails/changedIndexes) properties. Therefore, if you use this method to update a collection view or similar user interface displaying the contents of the fetch result, update your UI to reflect insertions, removals, and changes before you process moves.

---

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)