7

Is it possible to do this (with a menu, a shortcut, or a modifier key + mouse)?

For example, you can use the mouse to test simple touch gestures in the simulator, like left mouse acts as single finger, and shift / option allow for different two finger gestures.

I have been unable to find any documentation one way or the other about whether this is possible, despite this developer.apple.com page where the simple, easy-to-understand API changes for supporting Apple Pencil hardware are documented.

Do I need a physical iPad Pro + Pencil hardware to test my Pencil support?

(My app is not a drawing app, just an app where touch input should work with large touch targets and Pencil should allow finer distinctions.)

Jared Updike
  • 7,165
  • 8
  • 46
  • 72

2 Answers2

6

The Simulator does not currently support simulating Apple Pencil input. We are aware people would like to do this.

russbishop
  • 16,587
  • 7
  • 61
  • 74
1

iOS 14

#if targetEnvironment(simulator)
canvasView.drawingPolicy = .anyInput
#else
canvasView.drawingPolicy = .pencilOnly
#endif

Also in the Settings app there is a global setting called "Only Draw with Apple Pencil". This can be read from UIPencilInteraction.prefersPencilOnlyDrawing in PencilKit.

iOS 13 (only)

#if targetEnvironment(simulator)
canvasView.allowsFingerDrawing = true
#else
canvasView.allowsFingerDrawing = false
#endif

Courtesy of https://stackoverflow.com/a/62567169/2667933

Artem Kirillov
  • 1,132
  • 10
  • 25
  • This will work for some but not all of Apple Pencil features, i.e., only the ones that are shared with finger touches. Things like azimuth will not be available with this method. Having said that, it's a good solution for many applications. – Victor Engel Aug 04 '23 at 03:58