Inserting cells with animation

Now, let's add a button to add a new task to the list.

  1. Drag a Bar Button Item from Object Library and place it to the right of the top navigation bar. Also, change the item type from the Attribute Inspector tab to Add:
  1. Now, open the Assistant Editor to link an action method to the bar button item:
      @IBAction func didClickOnAddButton(_ sender: AnyObject) { 
      } 
  1. Now, add an IBOutlet to the table view in ViewController.swift, as follows:
      @IBOutlet weak var tasksTableView: UITableView! 
  1. Now, let's add a function that will display a pop-up alert with a text field to ask the user to enter the task name:
 func ...

Get iOS Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.