<!--
{
  "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/UITableViewDelegate/tableView(_:performPrimaryActionForRowAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITableViewDelegate(im)tableView:performPrimaryActionForRowAtIndexPath:"
  },
  "title" : "tableView(_:performPrimaryActionForRowAt:)"
}
-->

# tableView(_:performPrimaryActionForRowAt:)

Tells the delegate to perform the primary action for the row at the specified index path.

```
optional func tableView(_ tableView: UITableView, performPrimaryActionForRowAt indexPath: IndexPath)
```

## Parameters

`tableView`

The table view object on which to perform the primary action.

`indexPath`

The index path of the row.

## 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 row without extending an existing selection.

UIKit calls this method after [`tableView(_:willSelectRowAt:)`](/documentation/UIKit/UITableViewDelegate/tableView(_:willSelectRowAt:)) and [`tableView(_:didSelectRowAt:)`](/documentation/UIKit/UITableViewDelegate/tableView(_:didSelectRowAt:)), regardless of whether the row selection state changes. Use [`tableView(_:didSelectRowAt:)`](/documentation/UIKit/UITableViewDelegate/tableView(_:didSelectRowAt:)) to update the state of the current view controller (like its buttons, title, and so on), and use [`tableView(_:performPrimaryActionForRowAt:)`](/documentation/UIKit/UITableViewDelegate/tableView(_:performPrimaryActionForRowAt:)) for actions like navigation or showing another split view column.

If [`tableView(_:willSelectRowAt:)`](/documentation/UIKit/UITableViewDelegate/tableView(_:willSelectRowAt:)) returns an index path to allow selection for the row, only that row has selection when the system calls this method. If [`tableView(_:willSelectRowAt:)`](/documentation/UIKit/UITableViewDelegate/tableView(_:willSelectRowAt:)) returns `nil`, the system preserves the existing row selection in the table view. You can use this behavior to perform primary actions on nonselectable, button-style rows without changing the selection.

---

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)