Event

protocol Event : CustomDebugStringConvertible, Sendable

Basic interface for Trait events.

Events contain a record of past state transitions and other data that cannot easily be modeled by attributes.

  • Identifier for this event.

    The Event ID is appended onto the Trait ID of the trait this event belongs to.

    Declaration

    Swift

    static var identifier: ScopedEventID { get }
  • Name of the given event type.

    Declaration

    Swift

    static var name: StaticString { get }
  • Timestamp of when the given event occurred on the sender.

    Declaration

    Swift

    var timestamp: TimeInterval { get }
  • Reported importance level of the given event.

    Declaration

    Swift

    var importance: EventImportance { get }
  • Optional number of the event in the sequence history of this field.

    Declaration

    Swift

    var number: UInt { get }
  • Initializer to decode the event.

    Declaration

    Swift

    init(decoder: TraitDecoder, timestamp: TimeInterval, importance: EventImportance, number: UInt) throws
  • Encodes the given event.

    Declaration

    Swift

    func encode(with encoder: TraitEncoder) throws
  • eventField(id:)

    Default implementation

    Returns the field corresponding to the given field ID.

    Default Implementation

    Returns the field corresponding to the given field ID.

    Declaration

    Swift

    static func eventField(id: UInt32) -> (any Field)?