Instance Method

tableView(_:editActionsForRowAt:)

Asks the delegate for the actions to display in response to a swipe in the specified row.

Declaration

optional func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]?

Parameters

tableView

The table view object requesting this information.

indexPath

The index path of the row.

Return Value

An array of UITableViewRowAction objects representing the actions for the row. Each action you provide is used to create a button that the user can tap.

Discussion

Use this method when you want to provide custom actions for one of your table rows. When the user swipes horizontally in a row, the table view moves the row content aside to reveal your actions. Tapping one of the action buttons executes the handler block stored with the action object.

If you do not implement this method, the table view displays the standard accessory buttons when the user swipes the row.