loom & weft
Made for Swift.

Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.

LOOM Unreleased (PR #2) / COLLECTIONS AND INTERACTION

KeyChord

A logical key and its exact modifiers, ignoring Caps Lock and Num Lock.

Legacy Ctrl-C/Ctrl-D events match their extended-keyboard equivalents. Release events and pasted text never activate a chord. label can override the generated help label.

Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.

Members on this page

Feature guides and release status

KeyChord

Structure
struct KeyChord

Conforms to: Swift.Equatable, Swift.Sendable, Swift.SendableMetatype.

A logical key and its exact modifiers, ignoring Caps Lock and Num Lock.

Legacy Ctrl-C/Ctrl-D events match their extended-keyboard equivalents. Release events and pasted text never activate a chord. label can override the generated help label.

Source · KeyMap.swift:5

key

Instance Property
var key: Key

The logical key identity.

Source · KeyMap.swift:6

modifiers

Instance Property
var modifiers: KeyModifiers

Modifier and lock bits supplied by the terminal.

Source · KeyMap.swift:7

label

Instance Property
var label: String?

Visible item label.

Source · KeyMap.swift:8

init(_:modifiers:label:)

Initializer
init(_ key: Key, modifiers: KeyModifiers = [], label: String? = nil)

Creates a value with the supplied arguments. Default arguments are shown in the declaration.

Parameters (3)
key
Logical key to handle.
modifiers
Argument type and any default are shown in the declaration; see the behavior notes above.
label
Argument type and any default are shown in the declaration; see the behavior notes above.
Source · KeyMap.swift:10

matches(_:)

Instance Method
func matches(_ event: InputEvent) -> Bool

Matches key and exact modifiers after ignoring lock bits and normalizing legacy Ctrl-C/Ctrl-D. Releases and pasted text never match.

Parameters (1)
event
Argument type and any default are shown in the declaration; see the behavior notes above.

Returns Bool.

Source · KeyMap.swift:16

displayLabel

Instance Property
var displayLabel: String { get }

A public field of this type. Its value type and mutability are shown in the declaration.

Source · KeyMap.swift:23