<!--
{
  "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(_:shouldHighlightItemAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UICollectionViewDelegate(im)collectionView:shouldHighlightItemAtIndexPath:"
  },
  "title" : "collectionView(_:shouldHighlightItemAt:)"
}
-->

# collectionView(_:shouldHighlightItemAt:)

Asks the delegate if the item should be highlighted during tracking.

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

## Parameters

`collectionView`

The collection view object that is asking about the highlight change.

`indexPath`

The index path of the cell to be highlighted.

## Return Value

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

## Discussion

As touch events arrive, the collection view highlights items in anticipation of the user selecting them. As it processes those touch events, the collection view calls this method to ask your delegate if a given cell should be highlighted. It calls this method only in response to user interactions and does not call it if you programmatically set the highlighting on a cell.

If you return <doc://com.apple.documentation/documentation/Swift/false> in your implementation, the cell does not get highlighted and the system bypasses the entire selection process. That is, the system does not call [`collectionView(_:shouldSelectItemAt:)`](/documentation/UIKit/UICollectionViewDelegate/collectionView(_:shouldSelectItemAt:)) or any other selection-related methods. If you return <doc://com.apple.documentation/documentation/Swift/true>, [`isHighlighted`](/documentation/UIKit/UICollectionViewCell/isHighlighted) is set to <doc://com.apple.documentation/documentation/Swift/true>, [`collectionView(_:didHighlightItemAt:)`](/documentation/UIKit/UICollectionViewDelegate/collectionView(_:didHighlightItemAt:)) is called, and the system begins the selection process.

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)