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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.