How do the writing tools work?

Asked on 2024-07-30

1 search

Writing tools, introduced in the session Get started with Writing Tools, are a suite of features available in text fields across various apps on iOS, iPadOS, and macOS. These tools help users proofread, rewrite, or transform text seamlessly within native text fields. Here’s a breakdown of how they work:

  1. Invocation and Appearance:

    • Writing tools can be invoked by selecting a piece of text, which then appears on top of the keyboard or in the context menu next to cut, copy, and paste options on macOS.
    • They are available in the context menu and edit menu when hovering over selected text in native text views.
  2. Functionality:

    • Proofreading: Identifies and suggests corrections for misspellings and grammar errors.
    • Rewriting: Can rewrite text to make it more friendly, professional, or concise.
    • Summarizing: Summarizes text, converts it into key points, or transforms it into lists or tables.
    • Rich Text Support: Preserves attributes like styles, links, and attachments in the rewritten text.
  3. Integration with Text Views:

    • Writing tools work seamlessly with UITextView, NSTextView, and WKWebView when using TSC2 (Text Storage Component 2). For TSC1, a limited experience is provided.
    • The tools can handle lists and tables if the text view supports these features.
  4. Custom Text Views:

    • For custom text views, a basic experience is available for free, and more advanced features can be integrated with additional setup.
  5. Controlling Behavior:

    • Developers can control the behavior of writing tools, such as pausing syncing during a writing tool session or avoiding accidental editing.
    • New delegate methods and properties are introduced to manage the state and interaction of writing tools with text views.
  6. Protecting Ranges:

    • Developers can specify ranges of text to be ignored by writing tools, such as code blocks or quoted content, using new delegate methods in UITextFieldDelegate and NSTextViewDelegate.

For more detailed information, you can refer to the session chapters:

These tools are designed to enhance the text editing experience by providing powerful and intuitive features directly within the app's text fields.