<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/KeyEquivalent",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13KeyEquivalentV"
  },
  "title" : "KeyEquivalent"
}
-->

# KeyEquivalent

Key equivalents consist of a letter, punctuation, or function key that can
be combined with an optional set of modifier keys to specify a keyboard
shortcut.

```
struct KeyEquivalent
```

## Overview

Key equivalents are used to establish keyboard shortcuts to app
functionality. Any key can be used as a key equivalent as long as pressing
it produces a single character value. Key equivalents are typically
initialized using a single-character string literal, with constants for
unprintable or hard-to-type values.

The modifier keys necessary to type a key equivalent are factored in to the
resulting keyboard shortcut. That is, a key equivalent whose raw value is
the capitalized string “A” corresponds with the keyboard shortcut
Command-Shift-A. The exact mapping may depend on the keyboard layout—for
example, a key equivalent with the character value “}” produces a shortcut
equivalent to Command-Shift-] on ANSI keyboards, but would produce a
different shortcut for keyboard layouts where punctuation characters are in
different locations.

## Topics

### Getting arrow keys

[`upArrow`](/documentation/SwiftUI/KeyEquivalent/upArrow)

Up Arrow (U+F700)

[`downArrow`](/documentation/SwiftUI/KeyEquivalent/downArrow)

Down Arrow (U+F701)

[`leftArrow`](/documentation/SwiftUI/KeyEquivalent/leftArrow)

Left Arrow (U+F702)

[`rightArrow`](/documentation/SwiftUI/KeyEquivalent/rightArrow)

Right Arrow (U+F703)

### Getting other special keys

[`clear`](/documentation/SwiftUI/KeyEquivalent/clear)

Clear (U+F739)

[`delete`](/documentation/SwiftUI/KeyEquivalent/delete)

Delete (U+0008)

[`deleteForward`](/documentation/SwiftUI/KeyEquivalent/deleteForward)

Delete Forward (U+F728)

[`end`](/documentation/SwiftUI/KeyEquivalent/end)

End (U+F72B)

[`escape`](/documentation/SwiftUI/KeyEquivalent/escape)

Escape (U+001B)

[`home`](/documentation/SwiftUI/KeyEquivalent/home)

Home (U+F729)

[`pageDown`](/documentation/SwiftUI/KeyEquivalent/pageDown)

Page Down (U+F72D)

[`pageUp`](/documentation/SwiftUI/KeyEquivalent/pageUp)

Page Up (U+F72C)

[`return`](/documentation/SwiftUI/KeyEquivalent/return)

Return (U+000D)

[`space`](/documentation/SwiftUI/KeyEquivalent/space)

Space (U+0020)

[`tab`](/documentation/SwiftUI/KeyEquivalent/tab)

Tab (U+0009)

### Creating a key equivalent

[`init(_:)`](/documentation/SwiftUI/KeyEquivalent/init(_:))

Creates a new key equivalent from the given character value.

[`character`](/documentation/SwiftUI/KeyEquivalent/character)

The character value that the key equivalent represents.

## Relationships

### Conforms To

[`Copyable`](/documentation/Swift/Copyable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Escapable`](/documentation/Swift/Escapable)

[`Equatable`](/documentation/Swift/Equatable)

[`ExpressibleByExtendedGraphemeClusterLiteral`](/documentation/Swift/ExpressibleByExtendedGraphemeClusterLiteral)

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

[`ExpressibleByUnicodeScalarLiteral`](/documentation/Swift/ExpressibleByUnicodeScalarLiteral)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)