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

# writingToolsCoordinator(_:select:in:completion:)

Asks the delegate to update your view’s current text selection.

```
func writingToolsCoordinator(_ writingToolsCoordinator: NSWritingToolsCoordinator, select ranges: [NSValue], in context: NSWritingToolsCoordinator.Context, completion: @escaping @Sendable () -> Void)
```

```
func writingToolsCoordinator(_ writingToolsCoordinator: NSWritingToolsCoordinator, select ranges: [NSValue], in context: NSWritingToolsCoordinator.Context) async
```

## Parameters

`writingToolsCoordinator`

The coordinator object making the change
to your view.

`ranges`

One or more ranges of text to select. Each range is relative
to the text in your context object, and it’s your responsibility to
match each 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 the ranges 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 each value to get the correct range for that text storage.

`context`

The context object you use to identify the associated text storage.

`completion`

The completion handler to execute when your delegate finishes updating
the selection. The handler has no parameters or return value. You must
call this handler at some point during the implementation of your method.

## Discussion

As Writing Tools suggests changes to your view’s text, it calls this method
to update the text selection accordingly. Use this method to update the
current selection in your view’s text storage. When you finish making the
changes, call the provided completion block to let Writing Tools know you’re finished.

---

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)