A single action to present when the user swipes horizontally in a table row.


class UITableViewRowAction : NSObject


In an editable table, performing a horizontal swipe in a row reveals a button to delete the row by default. This class lets you define one or more custom actions to display for a given row in your table. Each instance of this class represents a single action to perform and includes the text, formatting information, and behavior for the corresponding button.

To add custom actions to your table view’s rows, implement the tableView(_:editActionsForRowAt:) method in your table view’s delegate object. In that method, create and return the actions for the indicated row. The table handles the remaining work of displaying the action buttons and executing the appropriate handler block when the user taps the button.


Creating a Table Row Action

Configuring the Action’s Appearance

var style: UITableViewRowAction.Style

The style applied to the action button.

var title: String?

The title of the action button.

var backgroundColor: UIColor?

The background color of the action button.

var backgroundEffect: UIVisualEffect?

The visual effect to apply to the button.


enum UITableViewRowAction.Style

Constants that help define the appearance of action buttons.


Inherits From

See Also


class UITableViewCell

A cell in a table view.

class UISwipeActionsConfiguration

The set of actions to perform when swiping on rows of a table.

class UIContextualAction

An action to display when the user swipes a table row.

enum UIContextualAction.Style

Constants indicating the style information that is applied to the action button.

Creating Self-Sizing Table View Cells

Create table view cells that support Dynamic Type and use system spacing constraints to adjust the spacing surrounding text labels.