Contents

NotificationCenter

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

Declaration

class NotificationCenter

Overview

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

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 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 instead.

Topics

Getting the default notification center

Adding and removing notification observers

Posting notifications

Receiving notifications as an asynchronous sequence

Receiving notifications as a Combine publisher

Using notification center with Swift actor isolation

See Also

Notifications