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

# collectionView(_:canFocusItemAt:)

Asks the delegate whether the item at the specified index path can be focused.

## Declaration

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

## Parameters

- `collectionView`: The collection view object requesting this information.
- `indexPath`: The index path of an item in the collection view.

## Return Value

Return Value true if the item can receive be focused or false if it can not.

## Discussion

Discussion You can use this method, or a cell’s canBecomeFocused method, to control which items in the collection view can receive focus. The focus engine calls the cell’s canBecomeFocused method first, the default implementation of which defers to the collection view and this delegate method. If you do not implement this method, the ability to focus on items depends on whether the collection view’s items are selectable. When the items are selectable, they can also be focused as if this method had returned true; otherwise, they do not receive focus.

## See Also

### Related Documentation

- [allowsSelection](uikit/uicollectionview/allowsselection.md)

### Working with focus

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