---
title: "deselectItem(at:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicollectionview/deselectitem(at:animated:)"
---

# deselectItem(at:animated:)

Deselects the item at the specified index.

## Declaration

```swift
func deselectItem(at indexPath: IndexPath, animated: Bool)
```

## Parameters

- `indexPath`: The index path of the item to select. Specifying nil results in no change to the current selection.
- `animated`: Specify doc://com.apple.documentation/documentation/Swift/true to animate the change in the selection or doc://com.apple.documentation/documentation/Swift/false to make the change without animating it.

## Discussion

Discussion If the allowsSelection property is false, calling this method has no effect. This method doesn’t cause any selection-related delegate methods to be called.

## See Also

### Selecting cells

- [indexPathsForSelectedItems](uikit/uicollectionview/indexpathsforselecteditems.md)
- [selectItem(at:animated:scrollPosition:)](uikit/uicollectionview/selectitem(at:animated:scrollposition:).md)
- [allowsSelection](uikit/uicollectionview/allowsselection.md)
- [allowsMultipleSelection](uikit/uicollectionview/allowsmultipleselection.md)
- [allowsSelectionDuringEditing](uikit/uicollectionview/allowsselectionduringediting.md)
- [allowsMultipleSelectionDuringEditing](uikit/uicollectionview/allowsmultipleselectionduringediting.md)
- [selectionFollowsFocus](uikit/uicollectionview/selectionfollowsfocus.md)
