<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionView/deselectItem(at:animated:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICollectionView(im)deselectItemAtIndexPath:animated:"
  },
  "title" : "deselectItem(at:animated:)"
}
-->

# deselectItem(at:animated:)

Deselects the item at the specified index.

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

If the [`allowsSelection`](/documentation/UIKit/UICollectionView/allowsSelection) property is <doc://com.apple.documentation/documentation/Swift/false>, calling this method has no effect.

This method doesn’t cause any selection-related delegate methods to be called.

---

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)