A serious bug in PencilKit that make all apps with PencilKit useless in iOS16

After testing iOS16, I've found a serious bug that make all apps with PencilKit (Prodrafts, InDraft, Pencil it in, Paint...) completely useless: If a canvasView is scrolled, all existing strokes will be shifted while writing with Apple Pencil. After writing, all strokes will be shifted back to its positions but it make users unable to write anything.

This bug is also occurs in the example app of PencilKit: https://developer.apple.com/documentation/pencilkit/drawing_with_pencilkit

It's easy to reprocedure: Run the example app, open a note, scroll down, then write something. You will see the bug (this bug only happens in iOS 16 and iPadOS 16).

I have sent multiple bug reports since the first days of the beta, none of them are answered. It's been 2 beta versions and the bug has not been fixed yet.
I'm an indie developer and I have worked with my app for 2 years - full time - 12 hours a day - no weekend. The main feature of my app is taking note with Apple Pencil and this bug made my app completely broken. I'm terrifying that 2 years of my work will be wasted.

Please answer me, give me hope. Thank you :(

Post not yet marked as solved Up vote post of TheLich Down vote post of TheLich
150 views

Replies

I am the developer of Pencil it in, also an indie and pretty worried about this. I haven't downloaded Xcode 14 yet so I can't test, but I have a feeling the issue is in the backing CAMetalLayer, since it only happens when writing, possibly related to drawableSize. If you have Xcode 14, it might be worth building and logging the drawableSize or other CAMetalLayer properties (bounds, frame, ...) between iOS 15/16. Getting a reference to the metal layer can be a bit tricky; it's within a private view. The hierarchy is PKCanvasView -> PKTiledView -> PKMetalView. You can access it with something like:

for v in canvasView.getAllSubviews() {
    for l in v.layer.sublayers ?? [] {
        if let metalLayer = l as? CAMetalLayer {
            print("Layer is ", metalLayer)
         }
     }
}

Where the helper function getAllSubviews() can be found on Stack Overflow

I will keep this forum updated on any progress made and would appreciate anyone else experiencing this do the same.