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

Customize requests

From the course: iOS and watchOS App Development: Notifications

Start my 1-month free trial

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…

Contents