Custom UI in notifications
In order to add custom UI to our notifications, we need to add an extension. Let's get started by doing the following:
- In the Navigator panel, select the Project navigator and, then, your project.
- At the bottom of the Targets area, click on the
+
button. - Select Notification Content Extension under Application Extension and, then, click on Next:
- In the options screen that appears, set Product Name to
LetsEatContentExtension
and click on Finish: - Next, select Activate in the screen that appears:
- This activation will allow us to build and run our custom UI extension in the simulator. Now, you have a choice of running our app, the iMessages app, our kit, or our custom UI extension.
Now that our extension is created, we need to be able to use it.
- Open the
info.plist
file in ourLetsEatContentExtension
folder. - Tap the NSExtension disclosure arrow to open up that key.
- Then, tap the disclosure arrow to open NSExtensionAttributes, under which you will see UNNotificationExtensionCategory...