From the course: iOS and watchOS App Development: Notifications
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Customize requests
From the course: iOS and watchOS App Development: Notifications
Customize requests
- [Instructor] Up 'til now, we've been using the notifications-centered delegates, responses handler for actions. The content extension has its own response handler, which will intercept and replace the delegates version. Let's make the like button a toggle between like and unlike. The content extension has another did receive method, which handles responses. Above the did receive method we have already, type in did receive, and you'll see did receive response. Add that one in, and then, inside of here, we're going to need the action identifier. So, I'm going to set that up as let action equals, and we'll use the response from the parameters. And we're going to get the action identifier from it. And then, head up to the top here. What we're going to be doing is toggling between like and unlike actions. So, I'm going to take this like action we have above it, copy it, paste it, and I'm going to make it an unlike action. And I'll just change the identifier to unlike, and the title to…
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.
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Add the content extension1m 15s
-
(Locked)
Change the UI3m 53s
-
(Locked)
Code the view controller4m 9s
-
(Locked)
Change plist settings3m 6s
-
(Locked)
Customize actions3m 4s
-
(Locked)
Customize requests4m 15s
-
(Locked)
Add buttons2m 57s
-
(Locked)
Use buttons for actions3m 31s
-
(Locked)
Code the snooze button3m 57s
-
(Locked)
-
-
-