Disable Smart Selection feature on PKCanvasView

I've been trying to disable the "Smart Selection" feature introduced in https://developer.apple.com/wwdc20/10107 from a PKCanvasView. This feature could be very useful for some apps but if you want to start from a clean state canvas it might get in your way as you add gestures and interactions.

Is there any way to opt out from it?

The #WWDC20-10107 video demonstrates the "Smart Selection" feature at around 1:27.

Answered by Juan in 757969022

Further investigation revealed that the Smart Selection feature is not really a PKCanvasView but a product of the interaction between a PKToolPicker and a PKCanvasView. That means that only when the PKToolPicker is visible the Smart Selection feature would run. Therefore the title of this post should be "Disable Smart Selection feature on PKToolPicker / PKCanvasView", and then the workaround (without any API changes) would be to hide the PKToolPicker as soon as a touch is detected on the PKCanvasView.

Accepted Answer

Further investigation revealed that the Smart Selection feature is not really a PKCanvasView but a product of the interaction between a PKToolPicker and a PKCanvasView. That means that only when the PKToolPicker is visible the Smart Selection feature would run. Therefore the title of this post should be "Disable Smart Selection feature on PKToolPicker / PKCanvasView", and then the workaround (without any API changes) would be to hide the PKToolPicker as soon as a touch is detected on the PKCanvasView.

At the moment this is s an issue in iPadOS 18 beta 4. My feedback is FB14511673:

On a PKCanvasView or a subclass there’s no documented approach to disable text (or stroke) selection that comes from the Smart Selection feature. In SwiftUI there’s a .textSelection modifier that permits this but it doesn’t have its counterpart in UIKit, or at least not in a understandable way. This applies to all versions of iPadOS, including iOS 18 beta 4.

Please provide a mechanism to selectively disable this feature from a PKCanvasView.

Disable Smart Selection feature on PKCanvasView
 
 
Q