LongPressEvent

struct LongPressEvent

Indicates that the momentary switch has been pressed for a long time.

  • Payload for the LongPressEvent.

    Declaration

    Swift

    struct Payload
  • Identifier for this event.

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

    Declaration

    Swift

    static let identifier: ScopedEventID
  • Name of the given event type.

    Declaration

    Swift

    static let name: StaticString
  • Timestamp of when the given event occurred on the sender.

    Declaration

    Swift

    let timestamp: TimeInterval
  • Reported importance level of the given event.

    Declaration

    Swift

    let importance: EventImportance
  • Optional number of the event in the sequence history of this field.

    Declaration

    Swift

    let number: UInt
  • 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
  • A textual representation of this instance, suitable for debugging.

    Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(reflecting:) initializer. This initializer works with any type, and uses the custom debugDescription property for types that conform to CustomDebugStringConvertible:

    struct Point: CustomDebugStringConvertible {
        let x: Int, y: Int
    
        var debugDescription: String {
            return "(\(x), \(y))"
        }
    }
    
    let p = Point(x: 21, y: 30)
    let s = String(reflecting: p)
    print(s)
    // Prints "(21, 30)"
    

    The conversion of p to a string in the assignment to s uses the Point type’s debugDescription property.

    Declaration

    Swift

    var debugDescription: String { get }
  • Returns the field corresponding to the given field ID.

    Declaration

    Swift

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