<!--
{
  "availability" : [
    "iOS: 17.5.0 -",
    "iPadOS: 17.5.0 -",
    "macCatalyst: 17.5.0 -",
    "macOS: 14.5.0 -",
    "visionOS: 26.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/PencilPreferredAction",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI21PencilPreferredActionV"
  },
  "title" : "PencilPreferredAction"
}
-->

# PencilPreferredAction

An action that the user prefers to perform after double-tapping their
Apple Pencil.

```
struct PencilPreferredAction
```

## Topics

### Getting the preferred actions

[`static let ignore: PencilPreferredAction`](/documentation/SwiftUI/PencilPreferredAction/ignore)

An action that does nothing.

[`static let runSystemShortcut: PencilPreferredAction`](/documentation/SwiftUI/PencilPreferredAction/runSystemShortcut)

An action that runs a system shortcut.

[`static let showColorPalette: PencilPreferredAction`](/documentation/SwiftUI/PencilPreferredAction/showColorPalette)

An action that toggles the display of the color palette.

[`static let showContextualPalette: PencilPreferredAction`](/documentation/SwiftUI/PencilPreferredAction/showContextualPalette)

An action that toggles the display of the contextual palette, or the
undo/redo panel if contextual palette is not available.

[`static let showInkAttributes: PencilPreferredAction`](/documentation/SwiftUI/PencilPreferredAction/showInkAttributes)

An action that toggles the display of the current tool’s ink attributes.

[`static let switchEraser: PencilPreferredAction`](/documentation/SwiftUI/PencilPreferredAction/switchEraser)

An action that switches between the current tool and the eraser.

[`static let switchPrevious: PencilPreferredAction`](/documentation/SwiftUI/PencilPreferredAction/switchPrevious)

An action that switches between the current tool and the last used tool.

## Relationships

### Conforms To

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

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

---

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)