<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSpellChecker",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSpellChecker"
  },
  "title" : "NSSpellChecker"
}
-->

# NSSpellChecker

An interface to the Cocoa spell-checking service.

```
class NSSpellChecker
```

## Overview

To handle all its spell checking, an app needs only one instance of [`NSSpellChecker`](/documentation/AppKit/NSSpellChecker), known as the spell checker. Using the spell checker you manage the Spelling panel, in which the user can specify decisions about words that are suspect. The spell checker also offers the ability to provide word completions to augment the text completion system.

## Topics

### Getting the Spell Checker

[`shared`](/documentation/AppKit/NSSpellChecker/shared)

Returns the NSSpellChecker (one per application).

[`sharedSpellCheckerExists`](/documentation/AppKit/NSSpellChecker/sharedSpellCheckerExists)

Returns whether the application’s NSSpellChecker has already been created.

### Configuring Spell Checkers Languages

[`availableLanguages`](/documentation/AppKit/NSSpellChecker/availableLanguages)

Provides a list of all available languages.

[`userPreferredLanguages`](/documentation/AppKit/NSSpellChecker/userPreferredLanguages)

Provides a subset of the available languages to be used for spell checking.

[`automaticallyIdentifiesLanguages`](/documentation/AppKit/NSSpellChecker/automaticallyIdentifiesLanguages)

Sets whether the spell checker will automatically identify languages.

[`language()`](/documentation/AppKit/NSSpellChecker/language())

Returns the current language used in spell checking.

[`setLanguage(_:)`](/documentation/AppKit/NSSpellChecker/setLanguage(_:))

Returns whether the specified language is in the Spelling pop-up list.

### Managing Panels

[`spellingPanel`](/documentation/AppKit/NSSpellChecker/spellingPanel)

Returns the spell checker’s panel.

[`substitutionsPanel`](/documentation/AppKit/NSSpellChecker/substitutionsPanel)

Returns the substitutions panel.

[`updateSpellingPanel(withGrammarString:detail:)`](/documentation/AppKit/NSSpellChecker/updateSpellingPanel(withGrammarString:detail:))

Specifies a grammar-analysis detail to highlight in the Spelling panel.

[`updatePanels()`](/documentation/AppKit/NSSpellChecker/updatePanels())

Updates the available panels to account for user changes.

[`accessoryView`](/documentation/AppKit/NSSpellChecker/accessoryView)

Makes a view an accessory of the Spelling panel by making it a subview of the panel’s content view.

[`substitutionsPanelAccessoryViewController`](/documentation/AppKit/NSSpellChecker/substitutionsPanelAccessoryViewController)

Sets the substitutions panel’s accessory view.

### Checking Strings for Spelling and Grammar

[`countWords(in:language:)`](/documentation/AppKit/NSSpellChecker/countWords(in:language:))

Returns the number of words in the specified string.

[`checkSpelling(of:startingAt:)`](/documentation/AppKit/NSSpellChecker/checkSpelling(of:startingAt:))

Starts the search for a misspelled word in `stringToCheck` starting at `startingOffset` within the string object.

[`checkSpelling(of:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:)`](/documentation/AppKit/NSSpellChecker/checkSpelling(of:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:))

Starts the search for a misspelled word in a string starting at specified offset within the string.

[`guessesForWord:`](/documentation/AppKit/NSSpellChecker/guessesForWord:)

Returns an array of suggested spellings for the misspelled word.

[`checkGrammar(of:startingAt:language:wrap:inSpellDocumentWithTag:details:)`](/documentation/AppKit/NSSpellChecker/checkGrammar(of:startingAt:language:wrap:inSpellDocumentWithTag:details:))

Initiates a grammatical analysis of a given string.

[`check(_:range:types:options:inSpellDocumentWithTag:orthography:wordCount:)`](/documentation/AppKit/NSSpellChecker/check(_:range:types:options:inSpellDocumentWithTag:orthography:wordCount:))

Requests unified text checking for the given range of the given string.

[`requestChecking(of:range:types:options:inSpellDocumentWithTag:completionHandler:)`](/documentation/AppKit/NSSpellChecker/requestChecking(of:range:types:options:inSpellDocumentWithTag:completionHandler:))

Requests that the string be checked in the background.

[`guesses(forWordRange:in:language:inSpellDocumentWithTag:)`](/documentation/AppKit/NSSpellChecker/guesses(forWordRange:in:language:inSpellDocumentWithTag:))

Returns an array of possible substitutions for the specified string.

### Managing the Spell-Checking Process

[`uniqueSpellDocumentTag()`](/documentation/AppKit/NSSpellChecker/uniqueSpellDocumentTag())

Returns a guaranteed unique tag to use as the spell-document tag for a document.

[`closeSpellDocument(withTag:)`](/documentation/AppKit/NSSpellChecker/closeSpellDocument(withTag:))

Notifies the receiver that the user has finished with the tagged document.

[`ignoreWord(_:inSpellDocumentWithTag:)`](/documentation/AppKit/NSSpellChecker/ignoreWord(_:inSpellDocumentWithTag:))

Instructs the spell checker to ignore all future occurrences of `wordToIgnore` in the document identified by `tag`.

[`ignoredWords(inSpellDocumentWithTag:)`](/documentation/AppKit/NSSpellChecker/ignoredWords(inSpellDocumentWithTag:))

Returns the array of ignored words for a document identified by `tag`.

[`setIgnoredWords(_:inSpellDocumentWithTag:)`](/documentation/AppKit/NSSpellChecker/setIgnoredWords(_:inSpellDocumentWithTag:))

Initializes the ignored-words document (a dictionary identified by `tag` with `someWords`), an array of words to ignore.

[`setWordFieldStringValue(_:)`](/documentation/AppKit/NSSpellChecker/setWordFieldStringValue(_:))

Sets the string that appears in the misspelled word field, using the string object `aString`.

[`updateSpellingPanel(withMisspelledWord:)`](/documentation/AppKit/NSSpellChecker/updateSpellingPanel(withMisspelledWord:))

Causes the spell checker to update the Spelling panel’s misspelled-word field to reflect `word`.

[`completions(forPartialWordRange:in:language:inSpellDocumentWithTag:)`](/documentation/AppKit/NSSpellChecker/completions(forPartialWordRange:in:language:inSpellDocumentWithTag:))

Provides a list of complete words that the user might be trying to type based on a partial word in a given string.

[`hasLearnedWord(_:)`](/documentation/AppKit/NSSpellChecker/hasLearnedWord(_:))

Indicates whether the spell checker has learned a given word.

[`unlearnWord(_:)`](/documentation/AppKit/NSSpellChecker/unlearnWord(_:))

Tells the spell checker to unlearn a given word.

[`forgetWord:`](/documentation/AppKit/NSSpellChecker/forgetWord:)

Remove this word from the spelling dictionary.

[`learnWord(_:)`](/documentation/AppKit/NSSpellChecker/learnWord(_:))

Adds the word to the spell checker dictionary.

[`userQuotesArray(forLanguage:)`](/documentation/AppKit/NSSpellChecker/userQuotesArray(forLanguage:))

Returns the default values for quote replacement.

[`userReplacementsDictionary`](/documentation/AppKit/NSSpellChecker/userReplacementsDictionary)

Returns the dictionary used when replacing words.

### Data Detector Interaction

[`menu(for:string:options:atLocation:in:)`](/documentation/AppKit/NSSpellChecker/menu(for:string:options:atLocation:in:))

Provides a menu containing contextual menu items suitable for certain kinds of detected results.

[`NSSpellChecker.OptionKey`](/documentation/AppKit/NSSpellChecker/OptionKey)

Constants that define options for text checking.

### Automatic Spelling Correction

[`correction(forWordRange:in:language:inSpellDocumentWithTag:)`](/documentation/AppKit/NSSpellChecker/correction(forWordRange:in:language:inSpellDocumentWithTag:))

Returns a single proposed correction if a word is mis-spelled.

[`showCorrectionIndicator(of:primaryString:alternativeStrings:forStringIn:view:completionHandler:)`](/documentation/AppKit/NSSpellChecker/showCorrectionIndicator(of:primaryString:alternativeStrings:forStringIn:view:completionHandler:))

Display a suitable user interface to indicate a correction may need to be made.

[`record(_:toCorrection:forWord:language:inSpellDocumentWithTag:)`](/documentation/AppKit/NSSpellChecker/record(_:toCorrection:forWord:language:inSpellDocumentWithTag:))

Records the user response to the correction indicator being displayed.

[`dismissCorrectionIndicator(for:)`](/documentation/AppKit/NSSpellChecker/dismissCorrectionIndicator(for:))

Dismisses the correction indicator for the specified view.

[`NSSpellChecker.CorrectionIndicatorType`](/documentation/AppKit/NSSpellChecker/CorrectionIndicatorType)

Constants that allow an app to specify the correction indicator type displayed.

[`NSSpellChecker.CorrectionResponse`](/documentation/AppKit/NSSpellChecker/CorrectionResponse)

The correction response passed to the[`record(_:toCorrection:forWord:language:inSpellDocumentWithTag:)`](/documentation/AppKit/NSSpellChecker/record(_:toCorrection:forWord:language:inSpellDocumentWithTag:)) method.

### Notifications

[`didChangeAutomaticSpellingCorrectionNotification`](/documentation/AppKit/NSSpellChecker/didChangeAutomaticSpellingCorrectionNotification)

This notification is posted when the spell checker did change text using automatic spell checking correction. The are posted to the application’s default notification center.

[`didChangeAutomaticTextReplacementNotification`](/documentation/AppKit/NSSpellChecker/didChangeAutomaticTextReplacementNotification)

Posted when the spell checker changed text using automatic text replacement.  This notification is posted to the app’s default notification center.

[`NSSpellCheckerDidChangeAutomaticInlinePredictionNotification`](/documentation/AppKit/NSSpellCheckerDidChangeAutomaticInlinePredictionNotification)

To observe this notification using Swift concurrency, use [`NSSpellChecker.DidChangeAutomaticInlinePredictionMessage`](/documentation/AppKit/NSSpellChecker/DidChangeAutomaticInlinePredictionMessage).

### Type Properties

[`didChangeAutomaticCapitalizationNotification`](/documentation/AppKit/NSSpellChecker/didChangeAutomaticCapitalizationNotification)

To observe this notification using Swift concurrency, use [`NSSpellChecker.DidChangeAutomaticCapitalizationMessage`](/documentation/AppKit/NSSpellChecker/DidChangeAutomaticCapitalizationMessage).

[`didChangeAutomaticDashSubstitutionNotification`](/documentation/AppKit/NSSpellChecker/didChangeAutomaticDashSubstitutionNotification)

To observe this notification using Swift concurrency, use [`NSSpellChecker.DidChangeAutomaticDashSubstitutionMessage`](/documentation/AppKit/NSSpellChecker/DidChangeAutomaticDashSubstitutionMessage).

[`didChangeAutomaticPeriodSubstitutionNotification`](/documentation/AppKit/NSSpellChecker/didChangeAutomaticPeriodSubstitutionNotification)

To observe this notification using Swift concurrency, use [`NSSpellChecker.DidChangeAutomaticPeriodSubstitutionMessage`](/documentation/AppKit/NSSpellChecker/DidChangeAutomaticPeriodSubstitutionMessage).

[`didChangeAutomaticQuoteSubstitutionNotification`](/documentation/AppKit/NSSpellChecker/didChangeAutomaticQuoteSubstitutionNotification)

To observe this notification using Swift concurrency, use [`NSSpellChecker.DidChangeAutomaticQuoteSubstitutionMessage`](/documentation/AppKit/NSSpellChecker/DidChangeAutomaticQuoteSubstitutionMessage).

[`didChangeAutomaticTextCompletionNotification`](/documentation/AppKit/NSSpellChecker/didChangeAutomaticTextCompletionNotification)

To observe this notification using Swift concurrency, use [`NSSpellChecker.DidChangeAutomaticTextCompletionMessage`](/documentation/AppKit/NSSpellChecker/DidChangeAutomaticTextCompletionMessage).

[`isAutomaticCapitalizationEnabled`](/documentation/AppKit/NSSpellChecker/isAutomaticCapitalizationEnabled)

[`isAutomaticDashSubstitutionEnabled`](/documentation/AppKit/NSSpellChecker/isAutomaticDashSubstitutionEnabled)

[`isAutomaticInlinePredictionEnabled`](/documentation/AppKit/NSSpellChecker/isAutomaticInlinePredictionEnabled)

[`isAutomaticPeriodSubstitutionEnabled`](/documentation/AppKit/NSSpellChecker/isAutomaticPeriodSubstitutionEnabled)

[`isAutomaticQuoteSubstitutionEnabled`](/documentation/AppKit/NSSpellChecker/isAutomaticQuoteSubstitutionEnabled)

[`isAutomaticSpellingCorrectionEnabled`](/documentation/AppKit/NSSpellChecker/isAutomaticSpellingCorrectionEnabled)

[`isAutomaticTextCompletionEnabled`](/documentation/AppKit/NSSpellChecker/isAutomaticTextCompletionEnabled)

[`isAutomaticTextReplacementEnabled`](/documentation/AppKit/NSSpellChecker/isAutomaticTextReplacementEnabled)

### Instance Methods

[`deletesAutospaceBetweenString(_:andString:language:)`](/documentation/AppKit/NSSpellChecker/deletesAutospaceBetweenString(_:andString:language:))

[`language(forWordRange:in:orthography:)`](/documentation/AppKit/NSSpellChecker/language(forWordRange:in:orthography:))

[`preventsAutocorrection(before:language:)`](/documentation/AppKit/NSSpellChecker/preventsAutocorrection(before:language:))

[`requestCandidates(forSelectedRange:in:types:options:inSpellDocumentWithTag:completionHandler:)`](/documentation/AppKit/NSSpellChecker/requestCandidates(forSelectedRange:in:types:options:inSpellDocumentWithTag:completionHandler:))

[`showInlinePrediction(forCandidates:client:)`](/documentation/AppKit/NSSpellChecker/showInlinePrediction(forCandidates:client:))



---

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)