Customizing our notifications
Before we can embed an image, we will need a test image. In the Assets
folder of the Navigator panel, create a new group, called Images. Then, in the project folder for this book, open the asset
folder for this chapter and, then, drag the image assets into the Images folder that we've just created.
Embedding images
Next, let's embed our images. First, return to the RestaurantDetailViewController.swift
file, and in the showNotification()
method we created, remove the following code:
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false) let identifier = "letsEatReservation" let request = UNNotificationRequest(identifier: identifier, content: content, trigger: trigger) UNUserNotificationCenter.current().add(request, withCompletionHandler: { error in // handle error })
Replace the deleted section of code with the following code:
do { let url = Bundle.main.url(forResource: "sample-restaurant-img@3x", withExtension...