Class

UNTextInputNotificationResponse

The user’s response to an actionable notification, including any custom text that the user typed or dictated.

Overview

A UNTextInputNotificationResponse object is the response object created for an action that allows the user to enter free form text. When defining the actions to display for your notifications, you can use an UNTextInputNotificationAction object to represent the action instead of an UNNotificationAction object. Apps use text-input actions when it makes sense for the user to provide custom text as part of the response. For example, a messaging app might let the user supply a custom response to an incoming message. When the user selects the action, the system creates an UNTextInputNotificationResponse object and fills its userText property with any user-provided text.

You do not create instances of this class yourself. When the user selects a text-input action from the notification interface, the user notification center object delivers an instance of this class to the userNotificationCenter(_:didReceive:withCompletionHandler:) method of its delegate object. Implement that delegate method and use it to extract any needed information from the response object.

For information about the other response-related properties, see UNNotificationResponse.

Topics

Getting the Text Response

var userText: String

The text response provided by the user.

Relationships

See Also

Categories and Actions

class UNNotificationCategory

A definition of a type of notification that your app supports and the custom actions to display with it.

class UNNotificationAction

A task to perform in response to a delivered notification.

class UNTextInputNotificationAction

An action that can accept user-specified text.