---
title: "textView(_:willCheckTextIn:options:types:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextviewdelegate/textview(_:willchecktextin:options:types:)"
---

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

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

## Declaration

```swift
@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

Return Value A dictionary containing an alternative to the options dictionary.

## Discussion

Discussion Invoked by checkText(in:types:options:), this method allows control over text checking optionss (via the return value) or types (by modifying the flags pointed to by the inout parameter checkingTypes)

## See Also

### Working With the Spelling Checker

- [textView(_:shouldSetSpellingState:range:)](appkit/nstextviewdelegate/textview(_:shouldsetspellingstate:range:).md)
- [textView(_:didCheckTextIn:types:options:results:orthography:wordCount:)](appkit/nstextviewdelegate/textview(_:didchecktextin:types:options:results:orthography:wordcount:).md)
