What's new in PencilKit

Description: PencilKit helps power creativity, writing, drawing, and animation in your iPad apps. Explore the latest improvements to our drawing and annotation framework, and discover how you can take advantage of APIs like PKToolPicker, PKCanvasView, and PKStroke to support new features in illustration and writing apps. To get the most out of this session, you should have a basic understanding of PencilKit. If you want to a refresher, “Introduction to PencilKit” from WWDC19 is a great place to start.

New fatures

  • Rich-selection experience:
    • Double-tap to select a word
    • Double-tap again to select a line
    • Grab selection handles to expand your selection
  • Enhanced tap-and-pan gesture: you can make noncontiguous selections by brushing over specific strokes
  • Add space between scribbles/notes:
    • Tap on the space between two lines
    • Tap Insert Space from the callout bar
    • Use the grab handle to adjust the amount of space
  • New color picker:
    • Saved colors
    • Eye dropper
  • Catalyst support

Pencil vs hand drawing

  • New (iOS 14 only) system settings for users to choose if they would like to draw only with the pencil or with fingers as well.
  • All apps need to respect that, if you have your own drawing engine, check UIPencilInteraction.prefersPencilOnlyDrawing
  • This can also be toggled directly on the tool picker:
  • PKCanvasView has been updated to reflect this preference with the new drawingPolicy, these are the possible values/behaviors:
    • anyInput: allows drawing on the canvas from any input source
    • pencilOnly: pencil touches are the only input that draw on the canvas
    • default:
      • if the tool picker is displayed, it follows UIPencilInteraction.prefersPencilOnlyDrawing
      • if the tool picker is hidden, it's the same as pencilOnly
  • You can also create your own PKToolPicker instances:
    • Need to be retained by your app
    • Each toolpicker can be used with different states with different canvases

Strokes Access

Missing anything? Corrections? Contributions are welcome 😃

Related

Written by

Federico Zanetello

Federico Zanetello

Software engineer with a strong passion for well-written code, thought-out composable architectures, automation, tests, and more.