Here's how to integrate Writing Tools with a custom text view, in other words, what we want to teach (but we start with a skeleton view and then guide them in adding the Writing Tools support:
On iOS and iPadOS, as long as your custom text view adopts UITextInteraction, you’ll get Writing Tools in the callout bar or context menu for free. If you can’t use UITextInteraction, you can also adopt UITextSelectionDisplayInteraction with UIEditMenuInteraction. Under the hood, Writing Tools relies on the UITextInput protocol to read and write the text and to anchor the popover.
For more about text interactions, check out some amazing previous WWDC talks.
For text views that don’t use text interactions, we’ve added a new optional property isEditable in UITextInput protocol. Adopt that to indicate if your text view supports editing.
@drmarkpowell can you help with this?
Here's how to integrate Writing Tools with a custom text view, in other words, what we want to teach (but we start with a skeleton view and then guide them in adding the Writing Tools support:
On iOS and iPadOS, as long as your custom text view adopts UITextInteraction, you’ll get Writing Tools in the callout bar or context menu for free. If you can’t use UITextInteraction, you can also adopt UITextSelectionDisplayInteraction with UIEditMenuInteraction. Under the hood, Writing Tools relies on the UITextInput protocol to read and write the text and to anchor the popover.
For more about text interactions, check out some amazing previous WWDC talks.
For text views that don’t use text interactions, we’ve added a new optional property isEditable in UITextInput protocol. Adopt that to indicate if your text view supports editing.