Mac Developer Library

Developer

Foundation Framework Reference NSSpellServer Class Reference

Options
Deployment Target:

On This Page
Language:

NSSpellServer

Inheritance


Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in OS X v10.0 and later.

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.

  • Assigns the specified delegate to the receiver.

    Declaration

    Swift

    unowned(unsafe) var delegate: NSSpellServerDelegate?

    Objective-C

    @property(assign) id<NSSpellServerDelegate> delegate

    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.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns the receiver’s delegate.

    Declaration

    Swift

    unowned(unsafe) var delegate: NSSpellServerDelegate?

    Objective-C

    @property(assign) id<NSSpellServerDelegate> delegate

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    func registerLanguage(_ language: String?, byVendor vendor: String?) -> Bool

    Objective-C

    - (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 YEStrue if the language is registered, NOfalse 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.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    func run()

    Objective-C

    - (void)run

    Discussion

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

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    func isWordInUserDictionaries(_ word: String, caseSensitive caseSensitive: Bool) -> Bool

    Objective-C

    - (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 YEStrue, the word is acceptable to the user.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • 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).

    Declaration

    Swift

    let NSGrammarRange: String let NSGrammarUserDescription: String let NSGrammarCorrections: String

    Objective-C

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

    Constants

    • NSGrammarRange

      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.

    • NSGrammarUserDescription

      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.

    • NSGrammarCorrections

      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.