loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / TERMINAL ALIASES FROM WEFT

Key

Logical key identities decoded from terminal input. Extended modifiers and key phases are carried separately by KeyEvent. .character carries text; .interrupt and .endOfInput are distinct from app-defined quit bindings.

loom.Key is an alias for weft.Key. It is available through import loom. The underlying type’s members are documented here.

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.

Example

let key: Key = .character("q")
switch key {
case .character("q"), .escape: break
default: break
}
Members on this page

Feature guides and release status

Key

Type Alias
typealias Key = weft.weft.Key

Logical key identities decoded from terminal input. Extended modifiers and key phases are carried separately by KeyEvent. .character carries text; .interrupt and .endOfInput are distinct from app-defined quit bindings.

Source · TerminalExports.swift:13

Underlying weft API

Key

Enumeration
enum Key

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

A key identity understood by the input decoder.

Source · Key.swift:2

unknown

Case
case unknown

Text input without a known physical key, such as an input-method event.

Source · Key.swift:4

enter

Case
case enter

The enter case. Associated values, if any, are shown in the declaration.

Source · Key.swift:5

tab

Case
case tab

The tab case. Associated values, if any, are shown in the declaration.

Source · Key.swift:6

character(_:)

Case
case character(String)

The character case. Associated values, if any, are shown in the declaration.

Source · Key.swift:7

function(_:)

Case
case function(Int)

The function case. Associated values, if any, are shown in the declaration.

Source · Key.swift:8

backspace

Case
case backspace

The backspace case. Associated values, if any, are shown in the declaration.

Source · Key.swift:9

delete

Case
case delete

The delete case. Associated values, if any, are shown in the declaration.

Source · Key.swift:10

insert

Case
case insert

The insert case. Associated values, if any, are shown in the declaration.

Source · Key.swift:11

escape

Case
case escape

The escape case. Associated values, if any, are shown in the declaration.

Source · Key.swift:12

interrupt

Case
case interrupt

The interrupt case. Associated values, if any, are shown in the declaration.

Source · Key.swift:13

endOfInput

Case
case endOfInput

The end of input case. Associated values, if any, are shown in the declaration.

Source · Key.swift:14

newline

Case
case newline

The newline case. Associated values, if any, are shown in the declaration.

Source · Key.swift:15

up

Case
case up

The up case. Associated values, if any, are shown in the declaration.

Source · Key.swift:16

down

Case
case down

The down case. Associated values, if any, are shown in the declaration.

Source · Key.swift:17

left

Case
case left

The left case. Associated values, if any, are shown in the declaration.

Source · Key.swift:18

right

Case
case right

The right case. Associated values, if any, are shown in the declaration.

Source · Key.swift:19

home

Case
case home

The home case. Associated values, if any, are shown in the declaration.

Source · Key.swift:20

end

Case
case end

The end case. Associated values, if any, are shown in the declaration.

Source · Key.swift:21

pageUp

Case
case pageUp

The page up case. Associated values, if any, are shown in the declaration.

Source · Key.swift:22

pageDown

Case
case pageDown

The page down case. Associated values, if any, are shown in the declaration.

Source · Key.swift:23

begin

Case
case begin

The keypad center key when it does not produce a digit.

Source · Key.swift:25

first

Case
case first

The first case. Associated values, if any, are shown in the declaration.

Source · Key.swift:26

last

Case
case last

The last case. Associated values, if any, are shown in the declaration.

Source · Key.swift:27

f2

Case
case f2

The f2 case. Associated values, if any, are shown in the declaration.

Source · Key.swift:28