<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NotificationCenter",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSNotificationCenter"
  },
  "title" : "NotificationCenter"
}
-->

# NotificationCenter

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

```
class NotificationCenter
```

## Overview

Callers register with a notification center to receive one or both of the following:

- ``doc://com.apple.foundation/documentation/Foundation/NSNotification`` objects, when working in Objective-C or with frameworks that only support ``doc://com.apple.foundation/documentation/Foundation/NSNotification``. Objects register with a notification center to receive notifications (``doc://com.apple.foundation/documentation/Foundation/NSNotification`` objects) using the ``doc://com.apple.foundation/documentation/Foundation/NotificationCenter/addObserver(_:selector:name:object:)`` or ``doc://com.apple.foundation/documentation/Foundation/NotificationCenter/addObserver(forName:object:queue:using:)`` methods, specifying a notification name and optionally a source object. When a caller adds itself as an observer, it specifies which notifications it should receive.
- ``doc://com.apple.foundation/documentation/Foundation/NotificationCenter/MainActorMessage`` and ``doc://com.apple.foundation/documentation/Foundation/NotificationCenter/AsyncMessage`` instances for use with Swift code, providing strong typing, appropriate actor isolation, and a more idiomatic Swift experience. Callers register with the notification center using the various flavors of the `addObserver(of:for:using:)` method, specifying either a message type or a convenience ``doc://com.apple.foundation/documentation/Foundation/NotificationCenter/MessageIdentifier`` to identify the notification messages to receive. See <doc://com.apple.foundation/documentation/Foundation/notification-center-messages> for more information about this API.

Callers may add observers for many different notifications, or even the same notification name or message type as produced by different source objects.

Each running app has a [`default`](/documentation/Foundation/NotificationCenter/default) notification center, and you can create new notification centers to organize communications in particular contexts.

A notification center can deliver notifications only within a single program. On macOS, if you want to post a notification to other processes or receive notifications from other processes, use [`DistributedNotificationCenter`](/documentation/Foundation/DistributedNotificationCenter) instead.

## Topics

### Getting the default notification center

[`default`](/documentation/Foundation/NotificationCenter/default)

The app’s default notification center.

### Adding and removing notification observers

[`addObserver(forName:object:queue:using:)`](/documentation/Foundation/NotificationCenter/addObserver(forName:object:queue:using:))

Adds an entry to the notification center to receive notifications that passed to the provided block.

[`addObserver(_:selector:name:object:)`](/documentation/Foundation/NotificationCenter/addObserver(_:selector:name:object:))

Adds an entry to the notification center to call the provided selector with the notification.

[`removeObserver(_:name:object:)`](/documentation/Foundation/NotificationCenter/removeObserver(_:name:object:))

Removes matching entries from the notification center’s dispatch table.

[`removeObserver(_:)`](/documentation/Foundation/NotificationCenter/removeObserver(_:)-2yciv)

Removes all entries specifying an observer from the notification center’s dispatch table.

### Posting notifications

[`post(_:)`](/documentation/Foundation/NotificationCenter/post(_:)-3x2st)

Posts a given notification to the notification center.     <!-- Notification -->

[`post(name:object:userInfo:)`](/documentation/Foundation/NotificationCenter/post(name:object:userInfo:))

Creates a notification with a given name, sender, and information and posts it to the notification center.

[`post(name:object:)`](/documentation/Foundation/NotificationCenter/post(name:object:))

Creates a notification with a given name and sender and posts it to the notification center.

### Receiving notifications as an asynchronous sequence

[`notifications(named:object:)`](/documentation/Foundation/NotificationCenter/notifications(named:object:))

Returns an asynchronous sequence of notifications produced by this center for a given notification name and optional source object.

[`NotificationCenter.Notifications`](/documentation/Foundation/NotificationCenter/Notifications)

An asynchronous sequence of notifications generated by a notification center.

### Receiving notifications as a Combine publisher

[`publisher(for:object:)`](/documentation/Foundation/NotificationCenter/publisher(for:object:))

Returns a publisher that emits events when broadcasting notifications.

[`NotificationCenter.Publisher`](/documentation/Foundation/NotificationCenter/Publisher)

A publisher that emits elements when broadcasting notifications.

### Using notification center with Swift actor isolation

[Notification center messages](/documentation/Foundation/notification-center-messages)

Use Foundation’s notification center with Swift concurrency.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)
