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

# collectionView(_:canPerformPrimaryActionForItemAt:)

Asks the delegate whether to perform a primary action for the cell at the specified index path.

## Declaration

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

## Parameters

- `collectionView`: The collection view object asking whether to perform a primary action.
- `indexPath`: The index path of the cell.

## Return Value

Return Value true if the primary action can be performed; otherwise, false. If you don’t implement this method, the default return value is true when the collection view isn’t in an editing state, and false when it is.

## Discussion

Discussion Primary actions allow you to distinguish between a distinct user action and a change in selection (like a focus change or other indirect selection change). A primary action occurs when a person selects a single cell without extending an existing selection. UIKit calls this method before collectionView(_:performPrimaryActionForItemAt:).

## See Also

### Managing actions for cells

- [collectionView(_:performPrimaryActionForItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:performprimaryactionforitemat:).md)
