loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / COLLECTIONS AND INTERACTION

KeyMap

Resolves keys in declaration order; the first enabled matching binding wins.

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

KeyMap

Structure
struct KeyMap<Action>

Conforms to: Swift.Sendable, Swift.SendableMetatype.

Resolves keys in declaration order; the first enabled matching binding wins.

Source · KeyMap.swift:96

bindings

Instance Property
var bindings: [KeyBinding<Action>]

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

Source · KeyMap.swift:97

init(_:)

Initializer
init(_ bindings: [KeyBinding<Action>])

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

Parameters (1)
bindings
Argument type and any default are shown in the declaration; see the behavior notes above.
Source · KeyMap.swift:99

action(for:)

Instance Method
func action(for event: InputEvent) -> Action?

Returns the first enabled matching binding action, respecting repeat policy. Does not dispatch or mutate application state.

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

Returns Action?.

Source · KeyMap.swift:103

helpText

Instance Property
var helpText: String { get }

Help is derived from the same active bindings used for dispatch.

Source · KeyMap.swift:112