Skip to main content
161

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Apple docs
macOS utilitiesApple

Shortcut recorder

Capture, validate, change, and clear native macOS keyboard shortcuts.

Public APILumenShortcutRecorderApple / SwiftUISwift product: LumenUI

Apple availability

Supported native targets

Import LumenUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.

Mac · macOS 13+

Native example

Use Shortcut recorder

Use only on macOS. Applications own conflict validation and command registration; Lumen handles capture and presentation.

Shortcut recorder rendered in the macOS Lumen playground
Verified runtime capturemacOS
swift
LumenShortcutRecorder(
    "Quick switch",
    shortcut: $shortcut
) { candidate in
    reserved.contains(candidate) ? "Already in use." : nil
}

Reference

Public API

The primary shared and platform-specific options exposed by LumenShortcutRecorder.

APIValues or typeDefaultDescription
labelLocalizedStringKeyRequiredNames the command being configured.
shortcutBinding<LumenShortcut?>RequiredStores the current keyboard shortcut.
validation((LumenShortcut) -> String?)?nilReturns an application conflict message or nil.
platformmacOSRequiredUses NSEvent keyboard capture and macOS modifier glyphs.

Native behavior

Design and accessibility

When to use it

Use only on macOS. Applications own conflict validation and command registration; Lumen handles capture and presentation.

Accessibility

Recording, current shortcut, validation error, cancel, change, and clear states all have visible native labels.

Apple docsSwiftUI package