Instance Method

tableView(_:willBeginEditingRowAt:)

Tells the delegate that the table view is about to go into editing mode.

Declaration

optional func tableView(_ tableView: UITableView, willBeginEditingRowAt indexPath: IndexPath)

Parameters

tableView

The table-view object providing this information.

indexPath

An index path locating the row in tableView.

Discussion

This method is called when the user swipes horizontally across a row; as a consequence, the table view sets its isEditing property to true (thereby entering editing mode) and displays a Delete button in the row identified by indexPath. In this "€œswipe to delete"€ mode the table view does not display any insertion, deletion, and reordering controls. This method gives the delegate an opportunity to adjust the application'€™s user interface to editing mode. When the table exits editing mode (for example, the user taps the Delete button), the table view calls tableView(_:didEndEditingRowAt:).

See Also

Editing Table Rows

func tableView(UITableView, didEndEditingRowAt: IndexPath?)

Tells the delegate that the table view has left editing mode.

func tableView(UITableView, editingStyleForRowAt: IndexPath)

Asks the delegate for the editing style of a row at a particular location in a table view.

func tableView(UITableView, titleForDeleteConfirmationButtonForRowAt: IndexPath)

Changes the default title of the delete-confirmation button.

func tableView(UITableView, shouldIndentWhileEditingRowAt: IndexPath)

Asks the delegate whether the background of the specified row should be indented while the table view is in editing mode.