Pencil Interactions

Handle double-tap interactions that a user makes on Apple Pencil.

Overview

Pencil interactions let your app detect double taps the user makes on their Apple Pencil. Supporting Pencil interactions in your app gives the user a quick way to perform an action such as switching between drawing tools by simply double-tapping their Apple Pencil.

Figure 1

Double-tap the Pencil to access functionality within your app

An illustration of a hand double-tapping an Apple Pencil with the index finger.

To receive the double tap, add a UIPencilInteraction object to your app's view. To receive screen touches that a user makes using Apple Pencil, handle the touch events in your view. To learn more about handling touches, see Touches, Presses, and Gestures.

Topics

First Steps

Handling Double Taps from Apple Pencil

Detect and respond to double taps a user makes on Apple Pencil.

Handling Input from Apple Pencil

Learn how to detect and respond to touches from Apple Pencil.

Interactions

class UIPencilInteraction

An interaction that tells your app the user double-tapped their Apple Pencil.

protocol UIPencilInteractionDelegate

The interface an object implements to handle double taps the user makes on their Apple Pencil.

See Also

User Interactions

Touches, Presses, and Gestures

Encapsulate your app's event-handling logic in gesture recognizers so that you can reuse that code throughout your app.

Drag and Drop

Bring drag and drop to your app by using interaction APIs with your views.

Focus-based Navigation

Navigate the interface of your UIKit app using a remote or game controller.

Peek and Pop

Use 3D Touch input to display custom previews and actions for your content.

Keyboard and Menus

Handle keyboard input, and display a menu of custom actions.

Accessibility

Make your apps accessible to everyone, including people with disabilities.