Setting up notifications 

Now that we have permission, we need to set up notifications. We will start setting up our buttons:

  1. Open the RestaurantDetailViewController.swift file.
  2. At the top of the file, under import UIKit, add the following:
import UserNotifications
  1. Add the following method after our @IBAction func unwindReviewCancel(segue: UIStoryboardSegue) {} method and before the last curly bracket of our class file:
@IBAction func onTimeTapped(sender: UIButton) {} 
  1. Save the file, and you will see an empty circle appear next to this new @IBAction.
  2. Open the RestaurantDetail.storyboard for which we are going to use the time buttons for our notifications. Select each button. In the Attributes inspector, update the text inside of eachbutton ...

Get iOS 12 Programming for Beginners - Third Edition 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.