Swipe Deletion of Table View Cells in UITableView with Swift

In this example I am going to show you how to delete table row with swipe in iOS devices

Now I am going to delete row from the following table

If you are not familiar with UITableView you see this article to study how to develop UITableView with data

We have the following code already from above example

So now we will add the code to delete row

So what you have to do is implement the tableView:editingStyleForRowAtIndexPath: selector in the delegate and the tableView:commit editingStyle:forRowAtIndexPath: selector in the data source of your table view:

You can run the application now and click where you want to start and hold down the mouse button and move the mouse slowly in the direction of the swipe and then release the mouse button
Now you can see the following screen

Now touch on the Delete button to delete the row

Leave a Reply

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