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

# collectionView(_:selectionFollowsFocusForItemAt:)

Asks the delegate whether to relate selection and focus behavior for the cell at the corresponding index path.

## Declaration

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

## Parameters

- `collectionView`: The collection view making the request.
- `indexPath`: The index path of the cell to determine selection and focus behavior for.

## Return Value

Return Value true if you want to automatically select the cell at the specified index path when focus moves to it; otherwise, false.

## Discussion

Discussion If the collection view’s selectionFollowsFocus property is true and you return false from this delegate method, focus still moves to the cell when the user selects it. However, when focus moves to the cell, the cell doesn’t automatically select.

## See Also

### Working with focus

- [collectionView(_:canFocusItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:canfocusitemat:).md)
- [indexPathForPreferredFocusedView(in:)](uikit/uicollectionviewdelegate/indexpathforpreferredfocusedview(in:).md)
- [collectionView(_:shouldUpdateFocusIn:)](uikit/uicollectionviewdelegate/collectionview(_:shouldupdatefocusin:).md)
- [collectionView(_:didUpdateFocusIn:with:)](uikit/uicollectionviewdelegate/collectionview(_:didupdatefocusin:with:).md)
