---
title: "collectionView(_:didHighlightItemAt:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicollectionviewdelegate/collectionview(_:didhighlightitemat:)"
---

# collectionView(_:didHighlightItemAt:)

Tells the delegate that the item at the specified index path was highlighted.

## Declaration

```swift
optional func collectionView(_ collectionView: UICollectionView, didHighlightItemAt indexPath: IndexPath)
```

## Parameters

- `collectionView`: The collection view object that is notifying you of the highlight change.
- `indexPath`: The index path of the cell that was highlighted.

## Discussion

Discussion The collection view calls this method only in response to user interactions and does not call it if you programmatically set the highlighting on a cell.

## See Also

### Managing cell highlighting

- [collectionView(_:shouldHighlightItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:shouldhighlightitemat:).md)
- [collectionView(_:didUnhighlightItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:didunhighlightitemat:).md)
