messages(of:for:bufferSize:)
Returns an asynchronous sequence of messages produced by this center for a given subject and message type.
Declaration
func messages<Message>(of subject: Message.Subject? = nil, for messageType: Message.Type, bufferSize limit: Int = 10) -> some Sendable & AsyncSequence<Message, Never> where Message : NotificationCenter.AsyncMessage, Message.Subject : AnyObject
Parameters
- subject:
The subject to observe. Specify a metatype to observe all values for a given type.
- messageType:
The message type to be observed.
- limit:
The maximum number of messages allowed to buffer.
Return Value
An asynchronous sequence of messages produced by this center.