---
title: "tableView(_:canPerformAction:forRowAt:withSender:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitableviewdelegate/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.

## Declaration

```swift
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 doc://com.apple.uikit/documentation/UIKit/UIResponderStandardEditActions/copy(_:) or doc://com.apple.uikit/documentation/UIKit/UIResponderStandardEditActions/paste(_:) method of the doc://com.apple.uikit/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

Return Value true if the command corresponding to action should appear in the editing menu, otherwise false. The default value is false.

## Discussion

Discussion This method is invoked after 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 false from this method.

## See Also

### Responding to row actions

- [tableView(_:leadingSwipeActionsConfigurationForRowAt:)](uikit/uitableviewdelegate/tableview(_:leadingswipeactionsconfigurationforrowat:).md)
- [tableView(_:trailingSwipeActionsConfigurationForRowAt:)](uikit/uitableviewdelegate/tableview(_:trailingswipeactionsconfigurationforrowat:).md)
- [tableView(_:shouldShowMenuForRowAt:)](uikit/uitableviewdelegate/tableview(_:shouldshowmenuforrowat:).md)
- [tableView(_:performAction:forRowAt:withSender:)](uikit/uitableviewdelegate/tableview(_:performaction:forrowat:withsender:).md)
- [tableView(_:editActionsForRowAt:)](uikit/uitableviewdelegate/tableview(_:editactionsforrowat:).md)
