A container for information broadcast through a notification center to all registered observers.


struct Notification


Creating a Notification

typealias Notification.Name

An alias for a type used to represent the name of a notification.

struct NSNotification.Name

The type used for the name of a notification.

Getting Notification Information

var name: Notification.Name

A tag identifying the notification.

var object: Any?

An object that the poster wishes to send to observers.

var userInfo: [AnyHashable : Any]?

Storage for values or objects related to this notification.

Comparing Notifications

static func != (Notification, Notification) -> Bool

Returns a Boolean value indicating whether two values are not equal.

static func == (Notification, Notification) -> Bool

Compares two notifications for equality.

Describing a Notification

var description: String

A textual description of the notification.

var debugDescription: String

A textual description of the notification suitable for debugging.

var customMirror: Mirror

A mirror that reflects the notification.

var hashValue: Int

The computed hash value for the notification.

Using Reference Types

class NSNotification

An object containing information broadcast to registered observers that bridges to Notification; use NSNotification when you need reference semantics or other Foundation-specific behavior.

typealias Notification.ReferenceType

An alias for this value type's equivalent reference type.

See Also


class NotificationCenter

A notification dispatch mechanism that enables the broadcast of information to registered observers.

class NotificationQueue

A notification center buffer.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software