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

# collectionView(_:shouldSelectItemAt:)

Asks the delegate if the specified item should be selected.

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

## Parameters

`collectionView`

The collection view object that is asking whether the selection should change.

`indexPath`

The index path of the cell to be selected.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the item should be selected or <doc://com.apple.documentation/documentation/Swift/false> if it should not.

## Discussion

The collection view calls this method when the user tries to select an item in the collection view. It does not call this method when you programmatically set the selection.

If you do not implement this method, the default return value is <doc://com.apple.documentation/documentation/Swift/true>.

---

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)