publisher(for:on:)
Generates a publisher for events of the specified type.
Declaration
@MainActor @preconcurrency func publisher<E>(for event: E.Type, on sourceObject: (any EventSource)? = nil) -> Scene.Publisher<E> where E : EventParameters
- event:
The event, like
SceneEvents.Update.self. - sourceObject:
The source of the event. Set to
nilto publish all events of the given type within the scene.
Return Value
A publisher for events of the specified type.