The NSUserNotification class is used to configure a notification that is scheduled for display by the NSUserNotificationCenter class.


The NSUserNotification object not only configures the notification, when the 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.

See NSUserNotificationCenter for more information.

Threading Information

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

Nested Types


These constants describe how the user notification was activated.


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?

Identifier for 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.



These constants describe how the user notification was activated.


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



Inherits From