Instance Method

requestCheckingOfString:range:types:options:inSpellDocumentWithTag:completionHandler:

Requests that the string be checked in the background.

Declaration

- (NSInteger)requestCheckingOfString:(NSString *)stringToCheck range:(NSRange)range types:(NSTextCheckingTypes)checkingTypes options:(NSDictionary<NSTextCheckingOptionKey, id> *)options inSpellDocumentWithTag:(NSInteger)tag completionHandler:(void (^)(NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *results, NSOrthography *orthography, NSInteger wordCount))completionHandler;

Parameters

stringToCheck

The string to check.

range

The range of the string to check.

checkingTypes

The type of checking to be performed. The possible constants are listed in NSTextCheckingType and can be combined using the C bit-wise OR operator to perform multiple checks at the same time.

options

The options dictionary specifying the types of checking to perform. See Spell Checking Option Dictionary Keys for the possible keys and expected values.

tag

An identifier unique within the application used to inform the spell checker which document that text is associated, potentially for many purposes, not necessarily just for ignored words. A value of 0 can be passed in for text not associated with a particular document.

completionHandler

The completion handler block object will be called (in an arbitrary context) when results are available, with the sequence number and results.

The block takes four arguments:

sequenceNumber

A monotonically increasing sequence number.

results

An array of NSTextCheckingResult objects describing particular items found during checking and their individual ranges, sorted by range origin, then range end, then result type..

orthography

The orthography of the string.

wordCount

The number of words in the range of the string.

Return Value

The return value is a monotonically increasing sequence number that can be used to keep track of requests in flight.

See Also

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.

Deprecated
- 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.