UANotificationAction
@interface UANotificationAction : NSObject
iOS version-independent wrapper for UNNotificationAction.
-
The string that you use internally to identify the action.
Declaration
Objective-C
@property (readonly, copy, nonatomic) NSString *_Nonnull identifier;
Swift
var identifier: String { get }
-
The localized string to use as the button title for the action.
Declaration
Objective-C
@property (readonly, copy, nonatomic) NSString *_Nonnull title;
Swift
var title: String { get }
-
The options with which to perform the action.
Declaration
Objective-C
@property (readonly, assign, nonatomic) UANotificationActionOptions options;
Swift
var options: UANotificationActionOptions { get }
-
Init method.
Declaration
Objective-C
- (nonnull instancetype)initWithIdentifier:(nonnull NSString *)identifier title:(nonnull NSString *)title options:(UANotificationActionOptions)options;
Swift
init(identifier: String, title: String, options: UANotificationActionOptions = [])
Parameters
identifier
The action’s identifier.
title
The action’s title.
options
The action’s options.
-
Creates an action with the specified title and options.
Declaration
Objective-C
+ (nonnull instancetype)actionWithIdentifier:(nonnull NSString *)identifier title:(nonnull NSString *)title options: (UANotificationActionOptions)options;
Parameters
identifier
The unique string that you use internally to identify the action. When the user selects the action, the system passes this string to your app and asks you to perform the related task. This parameter must not be nil.
title
The localized string to display to the user. This string is displayed in interface elements such as buttons that are used to represent actions. This parameter must not be nil.
options
Additional options for how the action should be performed. Add options sparingly and only when you require the related behavior. For a list of possible values, see UANotificationActionOptions.
-
Converts a UANotificationAction into a UNNotificationAction.
Declaration
Objective-C
- (nonnull UNNotificationAction *)asUNNotificationAction;
Swift
func asUNNotificationAction() -> UNNotificationAction
Return Value
An instance of UNotificationAction.
-
Tests for equivalence with a UNNotificationAction.
Declaration
Objective-C
- (BOOL)isEqualToUNNotificationAction: (nonnull UNNotificationAction *)notificationAction;
Swift
func isEqual(to notificationAction: UNNotificationAction) -> Bool
Parameters
notificationAction
The UNNNotificationAction to compare with.
Return Value
YES
if the two actions are equivalent,NO
otherwise.