<!--
{
  "availability" : [
    "iOS: 12.1.0 -",
    "iPadOS: 12.1.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 26.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIPencilInteraction",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIPencilInteraction"
  },
  "title" : "UIPencilInteraction"
}
-->

# UIPencilInteraction

An interaction that tells your app when a person double-taps or squeezes Apple Pencil.

```
@MainActor class UIPencilInteraction
```

## Overview

People can interact with certain models of Apple Pencil with a double tap or squeeze. To detect the double tap or squeeze in your app, create a [`UIPencilInteraction`](/documentation/UIKit/UIPencilInteraction) object with a corresponding [`delegate`](/documentation/UIKit/UIPencilInteraction/delegate) object. Then, add the interaction to your app’s view. When a person double-taps or squeezes Apple Pencil, the interaction calls the delegate’s corresponding [`pencilInteraction(_:didReceiveTap:)`](/documentation/UIKit/UIPencilInteractionDelegate/pencilInteraction(_:didReceiveTap:)) or [`pencilInteraction(_:didReceiveSqueeze:)`](/documentation/UIKit/UIPencilInteractionDelegate/pencilInteraction(_:didReceiveSqueeze:)) method.

For more information, read <doc://com.apple.documentation/documentation/ApplePencil/handling-double-taps-from-apple-pencil> and <doc://com.apple.documentation/documentation/ApplePencil/handling-squeezes-from-apple-pencil>.

## Topics

### Creating interactions

[`-  initWithDelegate:`](/documentation/UIKit/UIPencilInteraction/init(delegate:))

Creates an interaction with the specified delegate.

### Handling interactions

[`delegate`](/documentation/UIKit/UIPencilInteraction/delegate)

The object that handles the double-tap or squeeze interactions a person makes on Apple Pencil.

[`UIPencilInteractionDelegate`](/documentation/UIKit/UIPencilInteractionDelegate)

The interface an object implements to handle double taps or squeezes a person makes on Apple Pencil.

### Enabling interactions

[`enabled`](/documentation/UIKit/UIPencilInteraction/isEnabled)

A Boolean value that specifies whether the system reports double taps or squeezes on Apple Pencil to your app.

### Determining preferences for actions

[`preferredTapAction`](/documentation/UIKit/UIPencilInteraction/preferredTapAction)

A person’s preferred double-tap action for Apple Pencil, as specified in the Settings app.

[`preferredSqueezeAction`](/documentation/UIKit/UIPencilInteraction/preferredSqueezeAction)

A person’s preferred squeeze action for Apple Pencil, as specified in the Settings app.

[`UIPencilPreferredAction`](/documentation/UIKit/UIPencilPreferredAction)

The actions Apple Pencil can perform after a person performs a double tap or squeeze.

### Determining input type

[`prefersPencilOnlyDrawing`](/documentation/UIKit/UIPencilInteraction/prefersPencilOnlyDrawing)

A person’s preference for drawing with Apple Pencil only, as specified in the Settings app or the system tool picker.

### Determining hover preview preferences

[`prefersHoverToolPreview`](/documentation/UIKit/UIPencilInteraction/prefersHoverToolPreview)

A person’s preference for whether holding a supported model of Apple Pencil close to the screen shows a preview of the current drawing tool, as specified in the Settings app.

### Supporting types

[`Tap`](/documentation/UIKit/UIPencilInteraction/Tap)

An interaction that represents a double tap on Apple Pencil.

[`Squeeze`](/documentation/UIKit/UIPencilInteraction/Squeeze)

An interaction that represents a squeeze on Apple Pencil.

## Relationships

### Conforms To

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

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

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

[`UIInteraction`](/documentation/UIKit/UIInteraction)

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

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

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

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

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)