---
title: "collectionView(_:canMoveItemAt:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicollectionviewdatasource/collectionview(_:canmoveitemat:)"
---

# collectionView(_:canMoveItemAt:)

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

## Declaration

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

Return Value true if the item is allowed to move, or false if it isn’t.

## Discussion

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:) method, the collection view allows all items to be reordered.

## See Also

### Reordering items

- [collectionView(_:moveItemAt:to:)](uikit/uicollectionviewdatasource/collectionview(_:moveitemat:to:).md)
