An interface to the Cocoa spell-checking service.


@interface NSSpellChecker : NSObject


To handle all its spell checking, an app needs only one instance of 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.


Getting the Spell Checker


Returns the NSSpellChecker (one per application).


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

Configuring Spell Checkers Languages


Provides a list of all available languages.


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


Sets whether the spell checker will automatically identify languages.

- language

Returns the current language used in spell checking.

- setLanguage:

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

Managing Panels


Returns the spell checker’s panel.


Returns the substitutions panel.

- updateSpellingPanelWithGrammarString:detail:

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

- updatePanels

Updates the available panels to account for user changes.


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


Sets the substitutions panel’s accessory view.

Checking Strings for Spelling and Grammar

- countWordsInString:language:

Returns the number of words in the specified string.

- checkSpellingOfString:startingAt:

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

- checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:

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

- guessesForWord:

Returns an array of suggested spellings for the misspelled word.

- checkString:range:types:options:inSpellDocumentWithTag:orthography:wordCount:

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

- guessesForWordRange:inString:language:inSpellDocumentWithTag:

Returns an array of possible substitutions for the specified string.

Managing the Spell-Checking Process

+ uniqueSpellDocumentTag

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

- closeSpellDocumentWithTag:

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

- ignoreWord:inSpellDocumentWithTag:

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

- ignoredWordsInSpellDocumentWithTag:

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

- setIgnoredWords:inSpellDocumentWithTag:

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

- setWordFieldStringValue:

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

- updateSpellingPanelWithMisspelledWord:

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

- completionsForPartialWordRange:inString: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:

Indicates whether the spell checker has learned a given word.

- unlearnWord:

Tells the spell checker to unlearn a given word.

- forgetWord:

Remove this word from the spelling dictionary.

- learnWord:

Adds the word to the spell checker dictionary.

- userQuotesArrayForLanguage:

Returns the default values for quote replacement.


Returns the dictionary used when replacing words.

Data Detector Interaction

- menuForResult:string:options:atLocation:inView:

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

Automatic Spelling Correction

- correctionForWordRange:inString:language:inSpellDocumentWithTag:

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

- showCorrectionIndicatorOfType:primaryString:alternativeStrings:forStringInRect:view:completionHandler:

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

- recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:

Records the user response to the correction indicator being displayed.

- dismissCorrectionIndicatorForView:

Dismisses the correction indicator for the specified view.


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



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.


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


Inherits From

See Also

Spell Checker


A protocol that responder objects can implement to correct a misspelled word.


A protocol that enables the Ignore button in the Spelling panel to function properly.