Swift – UITableViewRowActions and editActionsForRowAtIndexPath

Do you like those button that display when you swipe a row in a table view to the left? You can add your own with little effort using UITableViewRowAction, and tableView(:editActionsForRowAtIndexPath).

tableView editActionsForRowAtIndexPath is a UITableViewDelegate method. This method returns an array of UITableViewRowAction’s. Each of these row actions includes a style, title, and action. The action receives the index path of the row where the action was executed.

Here is a sample gist:

 

Leave a Reply

Your email address will not be published. Required fields are marked *