<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextViewDelegate/textView(_:willCheckTextIn:options:types:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextViewDelegate(im)textView:willCheckTextInRange:options:types:"
  },
  "title" : "textView(_:willCheckTextIn:options:types:)"
}
-->

# textView(_:willCheckTextIn:options:types:)

Invoked to allow the delegate to modify the text checking process before it occurs.

```
@MainActor optional func textView(_ view: NSTextView, willCheckTextIn range: NSRange, options: [NSSpellChecker.OptionKey : Any] = [:], types checkingTypes: UnsafeMutablePointer<NSTextCheckingTypes>) -> [NSSpellChecker.OptionKey : Any]
```

## Parameters

`view`

The text view sending the message.

`range`

The range to be checked.

`options`

A dictionary of values used during the checking process to perform. See Spell Checking Option Dictionary Keys for the supported values.

`checkingTypes`

The type of checking to be performed, passed by-reference. The possible constants are listed in <doc://com.apple.documentation/documentation/Foundation/NSTextCheckingTypes> and can be combined using the C bit-wise `OR` operator to perform multiple checks at the same time.

    You can change this parameter to alter the types of checking to be performed.

## Return Value

A dictionary containing an alternative to the options `dictionary`.

## Discussion

Invoked by [`checkText(in:types:options:)`](/documentation/AppKit/NSTextView/checkText(in:types:options:)), this method allows control over text checking `options`s (via the return value) or types (by modifying the flags pointed to by the inout parameter `checkingTypes`)

---

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)