A notification that can be scheduled for display in the notification center.


class NSUserNotification : NSObject


When a notification is delivered, information about when the notification was actually presented to the user (if at all) and other details are provided in the notification object. User applications can create NSUserNotification objects and register them with the NSUserNotificationCenter object to notify the user when an application requires attention.

Threading Information

The NSUserNotificationCenter class and the NSUserNotification class are both thread safe.


Display Information

var title: String?

Specifies the title of the notification.

var subtitle: String?

Specifies the subtitle of the notification.

var informativeText: String?

The body text of the notification.

var contentImage: NSImage?

Image shown in the content of the notification.

var identifier: String?

A string that uniquely identifies a notification.

var response: NSAttributedString?

The response with which the user responded to a notification.

var responsePlaceholder: String?

Optional placeholder string for inline reply field.

Displayed Notification Buttons

var hasActionButton: Bool

A Boolean value that specifies whether the notification displays an action button.

var actionButtonTitle: String

Specifies the title of the action button displayed in the notification.

var otherButtonTitle: String

Specifies a custom title for the close button in an alert-style notification.

var hasReplyButton: Bool

A Boolean value that specifies whether the notification displays a reply button.

Delivery Timing

var deliveryDate: Date?

Specifies when the notification should be delivered.

var actualDeliveryDate: Date?

The date this notification was actually delivered.

var deliveryRepeatInterval: DateComponents?

Specifies the date components that control how often a user notification is repeated.

var deliveryTimeZone: TimeZone?

Specify the time zone to interpret the delivery date in.

Delivery Information

var isPresented: Bool

Specifies whether the user notification has been presented.

var isRemote: Bool

Specifies whether the remote was generated by a push notification.

var soundName: String?

Specifies the name of the sound to play when the notification is delivered.

User Notification Activation Method

var activationType: NSUserNotification.ActivationType

Specifies what caused a user notification to occur.

var additionalActivationAction: NSUserNotificationAction?

An additional action selected by the user.

var additionalActions: [NSUserNotificationAction]?

The actions that can be taken on a notification in addition to the default action.

User Notification User Information

var userInfo: [String : Any]?

Application-specific user info that can be attached to the notification.


enum NSUserNotification.ActivationType

These constants describe how the user notification was activated.


The default sound played by the user notification center for this notification.



Inherits From

See Also

User Notifications

class NSUserNotificationAction

An action that the user can take in response to receiving a notification.

class NSUserNotificationCenter

An object that delivers notifications from apps to the user.

protocol NSUserNotificationCenterDelegate

An interface that enables customizing the behavior of the default notification center.