<!--
{
  "availability" : [
    "macOS: 15.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWritingToolsCoordinator/Delegate-swift.protocol/writingToolsCoordinator(_:finish:for:in:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSWritingToolsCoordinatorDelegate(im)writingToolsCoordinator:finishTextAnimation:forRange:inContext:completion:"
  },
  "title" : "writingToolsCoordinator(_:finish:for:in:completion:)"
}
-->

# writingToolsCoordinator(_:finish:for:in:completion:)

Asks the delegate to clean up any state related to the specified
Writing Tools animation.

```
func writingToolsCoordinator(_ writingToolsCoordinator: NSWritingToolsCoordinator, finish textAnimation: NSWritingToolsCoordinator.TextAnimation, for range: NSRange, in context: NSWritingToolsCoordinator.Context, completion: @escaping @Sendable () -> Void)
```

```
func writingToolsCoordinator(_ writingToolsCoordinator: NSWritingToolsCoordinator, finish textAnimation: NSWritingToolsCoordinator.TextAnimation, for range: NSRange, in context: NSWritingToolsCoordinator.Context) async
```

## Parameters

`writingToolsCoordinator`

The coordinator object notifying you
that animations are about to begin.

`textAnimation`

The type of animation Writing Tools finished.

`range`

The range of text that finished animating. This range is
relative to the text in your context object, and it’s your responsibility
to match that location to the correct location in your text storage.
If you initialized the context object with the entire contents of
your view’s text storage, you can use `range` as-is to access that
text storage. However, if you initialized the context object with
only a portion of your view’s text, add the starting location of
your context object’s text to this value to get the correct range
for that text storage.

`context`

The context object that contains the original text.

`completion`

A completion handler to execute when you are done.
The handler has no return value and takes no parameters. You must
call this handler at some point during your implementation.

## Discussion

Use this method to clean up any data structures you created to support
the specified type of Writing Tools animation. You can also use this
method to restore the visibility of any text you hid previously. When
you finish your cleanup work, call the completion handler to notify Writing Tools.

Writing Tools calls this method only after previous calls to the
[`writingToolsCoordinator(_:prepareFor:for:in:completion:)`](/documentation/AppKit/NSWritingToolsCoordinator/Delegate-swift.protocol/writingToolsCoordinator(_:prepareFor:for:in:completion:))
and [`writingToolsCoordinator(_:requestsPreviewFor:of:in:completion:)`](/documentation/AppKit/NSWritingToolsCoordinator/Delegate-swift.protocol/writingToolsCoordinator(_:requestsPreviewFor:of:in:completion:))
methods for the same animation type. However, Writing Tools can interleave
calls to this method with calls to prepare an animation of a different
type. In your implementation of this method, make sure the actions you
take don’t interfere with other in-flight animations.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)