Class

# NotificationResponseButton

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Class for actions which appear as a button for the user to press.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                                        | Type                               | Read-Only | Shared |
|-----------------------------------------------------------------------------|------------------------------------|-----------|--------|
| `AuthenticationRequired<notificationresponsebutton.authenticationrequired>` | `Boolean</api/data_types/boolean>` |           |        |
| `BringToForeground<notificationresponsebutton.bringtoforeground>`           | `Boolean</api/data_types/boolean>` |           |        |
| `Caption<notificationresponsebutton.caption>`                               | `String</api/data_types/string>`   |           |        |
| `Destructive<notificationresponsebutton.destructive>`                       | `Boolean</api/data_types/boolean>` |           |        |
| `IconName<notificationresponsebutton.iconname>`                             | `String</api/data_types/string>`   |           |        |
| `Identifier<notificationresponsebutton.identifier>`                         | `String</api/data_types/string>`   |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                   | Parameters                                                                                                                                     | Returns | Shared |
|--------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
| `Constructor<notificationresponsebutton.constructor0>` | caption As `String</api/data_types/string>`, identifier As `String</api/data_types/string>`, iconName As `String</api/data_types/string>` = "" |         |        |

## Property descriptions

<div id="notificationresponsebutton.authenticationrequired">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationResponseButton.AuthenticationRequired

**AuthenticationRequired** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the device must be unlocked to display the action.

<div id="notificationresponsebutton.bringtoforeground">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationResponseButton.BringToForeground

**BringToForeground** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, this action brings the app to the foreground.

<div id="notificationresponsebutton.caption">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationResponseButton.Caption

**Caption** As `String</api/data_types/string>`

> The caption of the button for the action.

<div id="notificationresponsebutton.destructive">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationResponseButton.Destructive

**Destructive** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, you are indicating that this action is destructive in some way.
>
> A destructive action is one where the user will lose data in a way that isn't reversible or easily reversible.
>
> The captions of destructive actions will be drawn in red. Despite this fact, the caption should make it *very clear* that the action is destructive.

<div id="notificationresponsebutton.iconname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationResponseButton.IconName

**IconName** As `String</api/data_types/string>`

> The name of the icon.
>
> The name must be either an [SFSymbol](https://developer.apple.com/sf-symbols/), the name of an image in your project or the name of an image file in the root directly of the application bundle.

<div id="notificationresponsebutton.identifier">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationResponseButton.Identifier

**Identifier** As `String</api/data_types/string>`

> The value that will be passed to the `NotificationCenter.UserResponded<mobilenotifications.userresponded>` event.
>
> This value allows you to know which action the user took when the `NotificationCenter.UserResponded<mobilenotifications.userresponded>` event is called.

## Method descriptions

<div id="notificationresponsebutton.constructor0">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationResponseButton.Constructor

**Constructor**(caption As `String</api/data_types/string>`, identifier As `String</api/data_types/string>`, iconName As `String</api/data_types/string>` = "")

> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> `Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.
>
> </div>
>
> Creates a new <span class="title-ref">NotificationResponseButton</span> and sets its *caption*, *identifier* and icon to the values passed.
>
> The iconName can either be an SFSymbol or the name of an image in the app's bundle. In the case of a naming conflict, the SFSymbol will be used.

## Notes

If the `NotificationResponseCategory</api/user_interface/notifications/notificationresponsecategory>` you're creating only requires Yes and No buttons in order for the user to response to the notification, your app should create two <span class="title-ref">NotificationResponseButton</span> objects, one for each button.

## Compatibility

|                       |        |
|-----------------------|--------|
| **Project Types**     | Mobile |
| **Operating Systems** | iOS    |

<div class="seealso">

`NotificationResponseAction</api/user_interface/notifications/notificationresponseaction>` parent class; `NotificationResponseTextField</api/user_interface/notifications/notificationresponsetextfield>` class.

</div>
