<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionViewDataSource/collectionView(_:canMoveItemAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UICollectionViewDataSource(im)collectionView:canMoveItemAtIndexPath:"
  },
  "title" : "collectionView(_:canMoveItemAt:)"
}
-->

# collectionView(_:canMoveItemAt:)

Asks your data source object whether the specified item can move to another location in the collection view.

```
optional func collectionView(_ collectionView: UICollectionView, canMoveItemAt indexPath: IndexPath) -> Bool
```

## Parameters

`collectionView`

The collection view requesting this information.

`indexPath`

The index path of the item that the collection view is trying to move.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the item is allowed to move, or <doc://com.apple.documentation/documentation/Swift/false> if it isn’t.

## Discussion

Use this method to selectively allow or disallow the movement of items within a collection view. If you don’t implement this method, but you do implement the [`collectionView(_:moveItemAt:to:)`](/documentation/UIKit/UICollectionViewDataSource/collectionView(_:moveItemAt:to:)) method, the collection view allows all items to be reordered.

---

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)