Meet Scribble for iPad

Description: Scribble offers a lightweight, ergonomic, and enjoyable way of entering text on iPad with Apple Pencil. Discover how people can take advantage of Scribble and handwritten text in apps that use standard text input controls or that implement a custom text editing experience. You’ll learn how it integrates into TextKit, and when you’ll need to adopt the new UIScribbleInteraction and UIIndirectScribbleInteraction APIs to provide a delightful and consistent experience with Scribble in your app. To get the most out of this session, you should be familiar with UIKit text input controls, as well as keyboard input technologies. To get started, watch “Keyboard Input in iOS”. If you’re building a custom text editor, you should be familiar with the UITextInput protocol, TextKit, and related text input APIs. For more information, we recommend checking out “TextKit Best Practices” and “The Keys to a Better Text Input Experience.” And for design guidelines on pencil-based interaction, check out “Apple Pencil Design Essentials.”

Writing experience

  • You can write directly on a text field without the need to select the field first.
  • You can draw a horizontal line to select text and perform the normal text editing actions.
  • You can also scratch out some text that you want to delete.

Scribble Supporting APIs

  • Scribble relies on standard Text controls/inputs (UITextField, UITextView, ...)
  • Scribble does not support password fields (because Apple's recommended way to input password is via auto fill)
  • for custom UI elements Scribble relies on UIKit's text input protocols (UITextInput, UIKeyInput, UITextInputTraits, UITextInteraction)

New APIs

Scribble introduces two interactions, UIScribbleInteraction and UIIndirectScribbleInteraction, which are used to customize the behavior of Scribble in your app.

Both interactions are added to views where the custom behavior takes place.

UIScribbleInteraction

The interaction has a delegate, and this delegate is where an app can customize the Scribble experience, for example:

  • disabling Scribble on the view
  • delaying that view from becoming first responder until handwriting has momentarily paused
  • being informed when Scribble handwriting begins or ends

UIIndirectScribbleInteraction

Thanks to this interaction:

  • we can allow writing outside a input control.
  • this is also the interaction to use for UI that would become editable in response to a tap gesture.

This is done via the interaction's delegate. Which will provide the system information about elements, aka regions within the view that can be written into.

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.