Now, let's add a button to add a new task to the list.
- 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:
- Now, open the Assistant Editor to link an action method to the bar button item:
@IBAction func didClickOnAddButton(_ sender: AnyObject) { }
- Now, add an IBOutlet to the table view in ViewController.swift, as follows:
@IBOutlet weak var tasksTableView: UITableView!
- 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 ...