<!--
{
  "availability" : [
    "iOS: 5.0.0 - 13.0.0",
    "iPadOS: 5.0.0 - 13.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "tvOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITableViewDelegate/tableView(_:canPerformAction:forRowAt:withSender:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITableViewDelegate(im)tableView:canPerformAction:forRowAtIndexPath:withSender:"
  },
  "title" : "tableView(_:canPerformAction:forRowAt:withSender:)"
}
-->

# tableView(_:canPerformAction:forRowAt:withSender:)

Asks the delegate if the editing menu should omit the Copy or Paste command for a given row.

```
optional func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool
```

## Parameters

`tableView`

The table view that is making this request.

`action`

A selector type identifying the [`copy(_:)`](/documentation/UIKit/UIResponderStandardEditActions/copy(_:)) or [`paste(_:)`](/documentation/UIKit/UIResponderStandardEditActions/paste(_:)) method of the [`UIResponderStandardEditActions`](/documentation/UIKit/UIResponderStandardEditActions) informal protocol.

`indexPath`

The index path of the row.

`sender`

The object that initially sent the `copy:` or `paste:` message.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the command corresponding to `action` should appear in the editing menu, otherwise <doc://com.apple.documentation/documentation/Swift/false>. The default value is <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

This method is invoked after [`tableView(_:shouldShowMenuForRowAt:)`](/documentation/UIKit/UITableViewDelegate/tableView(_:shouldShowMenuForRowAt:)). It gives the developer the opportunity to exclude one of the commands—Copy or Paste—from the editing menu. For example, the user might have copied some cell content from one row but wants to paste into another row that doesn’t take the copied content. In a case like this, return <doc://com.apple.documentation/documentation/Swift/false> from this method.

---

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)