Contents

UIWritingToolsCoordinator

An object that manages interactions between Writing Tools and your custom text view.

Declaration

@MainActor class UIWritingToolsCoordinator

Mentioned in

Overview

Add a UIWritingToolsCoordinator object to a custom view when you want to add Writing Tools support to that view. The coordinator manages interactions between your view and the Writing Tools UI and back-end capabilities. When creating a coordinator, you supply a delegate object to respond to requests from the system and provide needed information. Your delegate delivers your view’s text to Writing Tools, incorporates suggested changes back into your text storage, and supports the animations that Writing Tools creates to show the state of an operation.

Create the UIWritingToolsCoordinator object when setting up your UI, and initialize it with a custom object that adopts the UIWritingToolsCoordinator.Delegate protocol. Add the coordinator to your view using the addInteraction(_:) method. When a coordinator is present on a view, the system adds UI elements to initiate Writing Tools operations.

When defining the delegate, choose an object from your app that has access to your view and its text storage. You can adopt the UIWritingToolsCoordinator.Delegate protocol in the view itself, or in another type that your view uses to manage content. During the interactions with Writing Tools, the delegate gets and sets the contents of the view’s text storage and supports Writing Tools behaviors.

Topics

Creating a coordinator object

Checking the availability of Writing Tools

Managing Writing Tools interactions

Getting the host views for effects

Configuring the experience

Reporting changes to Writing Tools

Managing the current state

Getting the supporting types

Instance Properties

See Also

Writing Tools for custom views