NSSpellServer Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in OS X v10.0 and later.
Companion guide
Declared in
NSSpellServer.h

Overview

The NSSpellServer class gives you a way to make your application’s spell checker available as a spelling service available to any application.

A service provider is an application that declares its availability in a standard way, so that any other applications that wish to use it can do so. If you build a spelling checker that makes use of the NSSpellServer class and list it as an available service, then users of any application that makes use of NSSpellChecker or includes a Services menu will see your spelling checker as one of the available dictionaries.

Tasks

Configuring Spelling Servers

Providing Spelling Services

Managing the Spell-Checking Process

Instance Methods

delegate

Returns the receiver’s delegate.

- (id < NSSpellServerDelegate >)delegate
Availability
  • Available in OS X v10.0 and later.
Declared In
NSSpellServer.h

isWordInUserDictionaries:caseSensitive:

Indicates whether a given word is in the user’s list of learned words or the document’s list of words to ignore.

- (BOOL)isWordInUserDictionaries:(NSString *)word caseSensitive:(BOOL)caseSensitive
Parameters
word

The word to compare with those in the user dictionaries.

caseSensitive

Specifies whether the comparison is case sensitive.

Return Value

A Boolean value indicating whether the word is in the user dictionaries. If YES, the word is acceptable to the user.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSSpellServer.h

registerLanguage:byVendor:

Notifies the receiver of a language your spelling checker can check.

- (BOOL)registerLanguage:(NSString *)language byVendor:(NSString *)vendor
Parameters
language

A string specifying the English name of a language on Apple’s list of languages.

vendor

A string that identifies the vendor (to distinguish your spelling checker from those that others may offer for the same language).

Return Value

Returns YES if the language is registered, NO if for some reason it can’t be registered.

Discussion

If your spelling checker supports more than one language, it should invoke this method once for each language. Registering a language-vendor combination causes it to appear in the Spelling panel’s pop-up menu of spelling checkers.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSSpellServer.h

run

Causes the receiver to start listening for spell-checking requests.

- (void)run
Discussion

This method starts a loop that never returns; you need to set the NSSpellServer object’s delegate before sending this message.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSSpellServer.h

setDelegate:

Assigns the specified delegate to the receiver.

- (void)setDelegate:(id < NSSpellServerDelegate >)anObject
Parameters
anObject

The delegate assigned to the receiver.

Discussion

Because the delegate is where the real work is done, this step is essential before telling the NSSpellServer object to run.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSSpellServer.h

Constants

Grammatical-Analysis Details

These constants are used as the keys in the outDetails dictionaries returned by spellServer:checkGrammarInString:language:details: and checkGrammarOfString:startingAt:language:wrap:inSpellDocumentWithTag:details: (NSSpellChecker).

NSString *const NSGrammarRange;
NSString *const NSGrammarUserDescription;
NSString *const NSGrammarCorrections;
Constants
NSGrammarRange

The value for the NSGrammarRange dictionary key should be an NSValue containing an NSRange, a subrange of the sentence range used as the return value, whose location should be an offset from the beginning of the sentence--so, for example, an NSGrammarRange for the first four characters of the overall sentence range should be {0, 4}. If the NSGrammarRange key is not present in the dictionary it is assumed to be equal to the overall sentence range.

Available in OS X v10.5 and later.

Declared in NSSpellServer.h.

NSGrammarUserDescription

The value for the NSGrammarUserDescription dictionary key should be an NSString containing descriptive text about that range, to be presented directly to the user; it is intended that the user description should provide enough information to allow the user to correct the problem. It is recommended that NSGrammarUserDescription be supplied in all cases, however, NSGrammarUserDescription or NSGrammarCorrections must be supplied in order for correction guidance to be presented to the user.

Available in OS X v10.5 and later.

Declared in NSSpellServer.h.

NSGrammarCorrections

The value for the NSGrammarCorrections key should be an NSArray of NSStrings representing potential substitutions to correct the problem, but it is expected that this may not be available in all cases. NSGrammarUserDescription or NSGrammarCorrections must be supplied in order for correction guidance to be presented to the user.

Available in OS X v10.5 and later.

Declared in NSSpellServer.h.