Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode iOS Simulator: can I use the mouse as pretend Apple Pencil input (on iPad Pro), for testing?

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.)

like image 584
Jared Updike Avatar asked Jun 19 '17 20:06

Jared Updike


People also ask

Does Apple Pencil work like a mouse?

No. The Pencil cannot act as a full functioning/full featured mouse.

Can you write on iPad with hand on screen?

Yes. When using an Apple Pencil, your iPad uses palm-rejection to sense - and ignore - your hand when resting on the screen. Pencil strokes are still recognised as you would expect. Handwriting recognition, however, remains an App-specific function.

How do I use Apple Pencil to write my screen?

You can use Apple Pencil to quickly take a picture of the iPad screen, then mark it up to share with others or use in documents. To capture the screen, swipe up with Apple Pencil from either corner at the bottom of your iPad. To mark up the screenshot, draw with Apple Pencil.

How do you simulate an iPad on a Mac?

Simulating Different iOS Devices Open the iOS simulator, if it's not already open. From the Hardware menu, select Device, and then select the type of device you want to simulate. The simulator window will change to match the dimensions of the device you selected.


2 Answers

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

like image 129
russbishop Avatar answered Nov 14 '22 20:11

russbishop


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

like image 39
Artem Kirillov Avatar answered Nov 14 '22 20:11

Artem Kirillov