One Logo Pool Ball
Foundation · IOS API REFERENCE

NotificationCenter.Notifications

class · iOS 15.0+ · SDK 27.1

final class Notifications

An asynchronous sequence of notifications generated by a notification center. Use the ``NotificationCenter/notifications(named:object:)`` method to create an instance of this type, then iterate over its elements with the `for`-`await`-`in` syntax. > Tip: > The ``Notification`` type doesn't conform to <doc://com.apple.documentation/documentation/swift/sendable>, so iterating over this asynchronous sequence produces a compiler warning. You can use a <doc://com.apple.documentation/documentation/swift/asyncsequence/map(_:)-1q1k3> or <doc://com.apple.documentation/documentation/swift/asyncsequence/compactmap(_:)-gfdq> operator on the sequence to extract sendable properties of the notification and iterate over those instead. See ``NotificationCenter/notifications(named:object:)`` for an example of this approach.

Members (1)

method · iOS 15.0+

makeAsyncIterator

TypeScript
makeAsyncIterator(): NotificationCenter_Notifications_Iterator
Swift declaration
final func makeAsyncIterator() -> NotificationCenter.Notifications.Iterator

Creates the asynchronous iterator that produces elements of this asynchronous sequence. - Returns: An instance of the `AsyncIterator` type used to produce elements of the asynchronous sequence.

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →