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.

Text response actions

Text response actions

From the course: iOS and watchOS App Development: Notifications

Start my 1-month free trial

Text response actions

- [Instructor] For most actions, a simple button to execute the action is enough. However, if you want to respond to someone in a messaging app, or need some other type of text input, then a button alone is not enough. The user notifications framework has a special sub-class of UN notification action that you can use to edit text input controller to your notification. As an example, you'll add a comment line to your notification. So go head and stop the app and head to the app delegate. And find the set categories function again. And we're going to add another action here underneath the cancel action and we're going to start calling it the let text input action. And that will equal a UN text input notification action. And you want the one with the placeholder this time. So we want this one that ends with placeholder on the end. K, and then a lot of this is going to be the same as what we did with the other actions. So the identifier, I'm going to make this text input. The title is…

Contents