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.
In-app notification
From the course: iOS and watchOS App Development: Notifications
In-app notification
- [Instructor] Our current app will show notifications everywhere but the app. The UNNotificationCenter has a delegate method. UNNotificationCenterDelegate, which turns on in app notifications. I want to use this on all the view controllers only once not for every controller. I'll use a separate file, NotificationCenterDelegate.swift I made to do this. Head over to that file. So we'll go ahead and stop the app and get rid of the stuff on the bottom and head over to NotificationCenter.swift and you'll see it's just a small thing, I got a couple of little extra support methods in there for the moment and we're just going to put some code in here. I'm going to start by adopting the delegate, which is UNUserNotificationCenterDelegate. This has no required method, so it doesn't give us any errors. So you can go ahead and start typing UNUserNotificationCenter and you'll see there are three methods that show up at the top here on an auto complete and it's really hard to read which one is…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.