I have found a possible cause and a workaround to fix this problem.
I found out that my pencilInteractionDidTap is not called if the view-controller that contains this interaction is presented via my own custom modalPresentationStyle. (Using my own Transitioning Controller)
If I change the modalPresentationStyle to a standard (.fullscreen) when presenting the above controller, the interaction works fine.
The problem could either be in my own transitioning code, or iOS. I have not investigated that part.
Also, when I was experimenting by creating a fresh app from templates, I found out that I had to pair my Apple Pencil at-least once even if it was already paired. Not sure if the pencil needs to do re-initialization in order to send the interactions to the new app.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: