Adjust the force values reported by Apple Pencil so that they are consistent with 3D Touch force values.
On a 3D Touch device, force from the user's fingers is measured perpendicular to the surface of the screen. However, force reported by Apple Pencil is measured along its long axis, which often is not perpendicular to the screen. Instead of using the Apple Pencil force values as is, you might want to compute only the perpendicular portion of the force so that you can use the same code for touches originating from the user’s fingers or from Apple Pencil.
Listing 1 shows how to add a
perpendicular property to the
UITouch class to report the perpendicular force supplied by Apple Pencil. For touches involving Apple Pencil, this method divides the reported force value by the sine of the pencil’s altitude. For other touches, it reports the existing force value.