NSNotification object (or simply, notification center) provides a mechanism for broadcasting information within a program. An
NSNotification object is essentially a notification dispatch table.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
Objects register with a notification center to receive notifications (
NSNotification objects) using the
add methods. Each invocation of this method specifies a set of notifications. Therefore, objects may register as observers of different notification sets by calling these methods several times.
Each running Cocoa program has a default notification center. You typically don’t create your own. An
NSNotification object can deliver notifications only within a single program. If you want to post a notification to other processes or receive notifications from other processes, use an instance of