loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / TERMINAL ALIASES FROM WEFT

KeyModifiers

An OptionSet of reported modifier and lock bits. Combine with array literals and test contains(.control), contains(.shift), and so on. Protocol support determines which modifiers are available.

loom.KeyModifiers is an alias for weft.KeyModifiers. 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 modifiers: KeyModifiers = [.shift, .control]
_ = modifiers.contains(.control)
Members on this page

Feature guides and release status

KeyModifiers

Type Alias
typealias KeyModifiers = weft.weft.KeyModifiers

An OptionSet of reported modifier and lock bits. Combine with array literals and test contains(.control), contains(.shift), and so on. Protocol support determines which modifiers are available.

Source · TerminalExports.swift:16

Underlying weft API

KeyModifiers

Structure
struct KeyModifiers

Conforms to: Swift.Equatable, Swift.ExpressibleByArrayLiteral, Swift.OptionSet, Swift.RawRepresentable, Swift.Sendable, Swift.SendableMetatype, Swift.SetAlgebra.

Modifier bits reported by supported terminal keyboard protocols.

Source · KeyEvent.swift:2

rawValue

Instance Property
let rawValue: UInt8

Underlying identifier, bit field, or enum representation; see the containing type.

Source · KeyEvent.swift:3

init(rawValue:)

Initializer
init(rawValue: UInt8)

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

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

shift

Type Property
static let shift: KeyModifiers

Shift modifier bit.

Source · KeyEvent.swift:9

alt

Type Property
static let alt: KeyModifiers

Alt/Option modifier bit.

Source · KeyEvent.swift:10

control

Type Property
static let control: KeyModifiers

Control modifier bit.

Source · KeyEvent.swift:11

superKey

Type Property
static let superKey: KeyModifiers

Super/Command modifier bit when reported.

Source · KeyEvent.swift:12

hyper

Type Property
static let hyper: KeyModifiers

Hyper modifier bit when reported.

Source · KeyEvent.swift:13

meta

Type Property
static let meta: KeyModifiers

Meta modifier bit when reported.

Source · KeyEvent.swift:14

capsLock

Type Property
static let capsLock: KeyModifiers

Caps Lock state bit.

Source · KeyEvent.swift:15

numLock

Type Property
static let numLock: KeyModifiers

Num Lock state bit.

Source · KeyEvent.swift:16