Editing table views
Table views are not meant only for displaying data (read-only); users can be engaged in managing the table views to insert, update, delete, and reorder the table view cells. Thanks to UITableView
, these kinds of operations are not difficult to implement and with just simple lines of code, you can bring all these awesome features to your app. In this section, we will see how to trigger the editing mode in table view to delete or reorder cells. We will see how to insert new rows at runtime to the table view with animations as well.
Getting ready
In the demo project that we will implement, we are building a simple Todo app. We will have a screen where the user can see a list of open tasks and options to add new tasks, delete specific tasks, and reorder tasks based on priority. This demo will be very interesting.
How to do it...
First, let's create a new Xcode project with Single View Application template.
Add a table view and configure its delegate and data source, as we learnt...