<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionViewDelegate/collectionView(_:canPerformPrimaryActionForItemAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UICollectionViewDelegate(im)collectionView:canPerformPrimaryActionForItemAtIndexPath:"
  },
  "title" : "collectionView(_:canPerformPrimaryActionForItemAt:)"
}
-->

# collectionView(_:canPerformPrimaryActionForItemAt:)

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

```
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

<doc://com.apple.documentation/documentation/Swift/true> if the primary action can be performed; otherwise, <doc://com.apple.documentation/documentation/Swift/false>. If you don’t implement this method, the default return value is <doc://com.apple.documentation/documentation/Swift/true> when the collection view isn’t in an editing state, and <doc://com.apple.documentation/documentation/Swift/false> when it is.

## 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:)`](/documentation/UIKit/UICollectionViewDelegate/collectionView(_:performPrimaryActionForItemAt:)).

---

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)