---
title: "checkText(in:types:options:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextview/checktext(in:types:options:)"
---

# checkText(in:types:options:)

Check and replace the text in the range using the specified checking types and options.

## Declaration

```swift
func checkText(in range: NSRange, types checkingTypes: NSTextCheckingTypes, options: [NSSpellChecker.OptionKey : Any] = [:])
```

## Parameters

- `range`: The range to check.
- `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.
- `options`: A dictionary of values used during the checking process to perform. See Spell Checking Option Dictionary Keys for the supported values.

## Discussion

Discussion This method calls the delegate method textView(_:willCheckTextIn:options:types:) allowing you to modify the parameters before the checking occurs. This method usually would not be called directly, since NSTextView itself will call it as needed, but it can be overridden.

## See Also

### Checking and substituting text

- [checkTextInDocument(_:)](appkit/nstextview/checktextindocument(_:).md)
- [checkTextInSelection(_:)](appkit/nstextview/checktextinselection(_:).md)
- [handleTextCheckingResults(_:forRange:types:options:orthography:wordCount:)](appkit/nstextview/handletextcheckingresults(_:forrange:types:options:orthography:wordcount:).md)
- [enabledTextCheckingTypes](appkit/nstextview/enabledtextcheckingtypes.md)
- [isAutomaticDashSubstitutionEnabled](appkit/nstextview/isautomaticdashsubstitutionenabled.md)
- [toggleAutomaticDashSubstitution(_:)](appkit/nstextview/toggleautomaticdashsubstitution(_:).md)
- [isAutomaticDataDetectionEnabled](appkit/nstextview/isautomaticdatadetectionenabled.md)
- [toggleAutomaticDataDetection(_:)](appkit/nstextview/toggleautomaticdatadetection(_:).md)
- [isAutomaticSpellingCorrectionEnabled](appkit/nstextview/isautomaticspellingcorrectionenabled.md)
- [toggleAutomaticSpellingCorrection(_:)](appkit/nstextview/toggleautomaticspellingcorrection(_:).md)
- [isAutomaticTextReplacementEnabled](appkit/nstextview/isautomatictextreplacementenabled.md)
- [toggleAutomaticTextReplacement(_:)](appkit/nstextview/toggleautomatictextreplacement(_:).md)
- [performValidatedReplacement(in:with:)](appkit/nstextview/performvalidatedreplacement(in:with:).md)
