Contents

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 : Event

Parameters

  • event:

    The event, like SceneEvents.Update.self.

  • sourceObject:

    The source of the event. Set to nil to publish all events of the given type within the scene.

Return Value

A publisher for events of the specified type.

See Also

Publishing and subscribing to events