KeyboardShortcutLocalization

Options for how a keyboard shortcut participates in automatic localization.

StructureiOS 15.0+macOS 12.0+KeyboardShortcut.Localization in SwiftUI

Declaration

React
type KeyboardShortcutLocalization = 'automatic' | 'custom' | 'withoutMirroring';
Swift
struct Localization

Pass a literal, or build one with SwiftUI.KeyboardShortcutLocalization from import { SwiftUI } from 'swiftui-react-native'.

Type properties

Overview

A shortcut's key that is defined on an US-English keyboard layout might not be reachable on international layouts. For example the shortcut ⌘[ works well for the US layout but is hard to reach for German users. On the German keyboard layout, pressing ⌥5 will produce [, which causes the shortcut to become ⌥⌘5. If configured, which is the default behavior, automatic shortcut remapping will convert it to ⌘Ö.

In addition to that, some keyboard shortcuts carry information about directionality. Right-aligning a block of text or seeking forward in context of music playback are such examples. These kinds of shortcuts benefit from the option KeyboardShortcut.Localization-swift.struct.withoutMirroring to tell the system that they won't be flipped when running in a right-to-left context.

From Apple’s SwiftUI documentation. Code samples there are Swift.

Used by

See also

More in Input and interaction.