AnyEvent

struct AnyEvent
extension AnyEvent : Sendable

Struct holding information about a generic, encoded event that has yet to be parsed into its corresponding concrete type.

  • id

    Event Identifier indicating the type of the event – this corresponds to the identifier property on the corresponding concrete event type that this can be decoded into.

    Declaration

    Swift

    let id: String
  • Returns whether the given AnyEvent contains an event of type T.

    Declaration

    Swift

    func isEventType<T>(_ type: T.Type) -> Bool where T : Event
  • Attempts to decode the given GenericEvent into the concrete event type T.

    Throws

    A HomeError if the decoding fails.

    Declaration

    Swift

    func decode<T>(as type: T.Type = T.self) throws -> T where T : Event

    Return Value

    The decoded event of type T.