PencilKit PKCanvasView flicker

I have the following setup: UIViewRepresentable with a UIView holding

  • UIScrollView
    • ImageView
  • PKCanvasView

this is in order to make it appear as if you are writing on a paper which you can zoom and scroll. The UIImageView is holding the paper image.

The problem is if you draw some pen strokes at zoom level 1, then zoom in (say zoom level 2) as soon as you place down the pen, the PKCanvasView starts flickering repeatedly very badly. A sample video is here: https://youtube.com/shorts/5zeq6EDheSM

a small sample project showing this is here: https://www.icloud.com/iclouddrive/0a0NSLP4bsism69L7jRtZPIhQ#BugDemo

PencilKit PKCanvasView flicker
 
 
Q