From the course: iOS and watchOS App Development: Notifications

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Notification requests

Notification requests

From the course: iOS and watchOS App Development: Notifications

Start my 1-month free trial

Notification requests

- [Instructor] Once you have content and a trigger, you can add a notification request to the Notification Center. This process is often the same for all your notifications. If I have more than one type of notification, I tend to make a function or request any of them. So we're going to make this function and I'll stick it down here just above the notification content we made earlier. I give myself some space. And it'll be func add notification, and there'll be three things in here. The first one you already know about is UNNotificationTrigger. And you'll notice here we didn't use one of the individual triggers. This is the base class for all of them. And so you can put anyone you want in there. And then for content, I'll put you in UNMutable notification content again. And then something new, which will be an identifier, we shall talk about in a second. And that's a String. So in order to talk about the identifier, I'm going to add another line first. And then select request equal…

Contents