<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSSpellServerDelegate/spellServer(_:check:offset:types:options:orthography:wordCount:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSSpellServerDelegate(im)spellServer:checkString:offset:types:options:orthography:wordCount:"
  },
  "title" : "spellServer(_:check:offset:types:options:orthography:wordCount:)"
}
-->

# spellServer(_:check:offset:types:options:orthography:wordCount:)

Gives the delegate the opportunity to analyze both the spelling and grammar simultaneously, which is more efficient.

```
optional func spellServer(_ sender: NSSpellServer, check stringToCheck: String, offset: Int, types checkingTypes: NSTextCheckingTypes, options: [String : Any]? = nil, orthography: NSOrthography?, wordCount: UnsafeMutablePointer<Int>) -> [NSTextCheckingResult]?
```

## Parameters

`sender`

Spell server making the analysis request.

`stringToCheck`

String to analyze.

`offset`

The offset in the string.

`checkingTypes`

The text checking types to perform.

`options`

A dictionary defining the actions to be taken while checking this string. See Constants in <doc://com.apple.documentation/documentation/AppKit/NSSpellChecker> for the possible keys.

`orthography`

The identified orthography of `stringToCheck`. See [`NSOrthography`](/documentation/Foundation/NSOrthography) for more information.

`wordCount`

On output, returns by-reference the number of words from the beginning of the string object until the misspelled word (or the end of string).

## Return Value

An array of NSTextCheckingResult instances of the spelling, grammar, or correction types, depending on the `checkingTypes` requested.

## Discussion

This method is optional, but if implemented it will be called during the course of unified text checking via the `NSSpellChecker` <doc://com.apple.documentation/documentation/AppKit/NSSpellChecker/checkSpelling(of:startingAt:)> and <doc://com.apple.documentation/documentation/AppKit/NSSpellChecker/requestChecking(of:range:types:options:inSpellDocumentWithTag:completionHandler:)> methods.  This allows spelling and grammar checking to be performed simultaneously, which can be significantly more efficient, and allows the delegate to return autocorrection results as well.

If this method is not implemented, then unified text checking will call the separate spelling and grammar checking methods instead.

This method may be called repeatedly with strings representing different subranges of the string that was originally requested to be checked; the offset argument represents the offset of the portion passed in to this method within that original string, and should be added to the origin of the range in any [`NSTextCheckingResult`](/documentation/Foundation/NSTextCheckingResult) returned.

## See Also

  [Spell Checking Programming Topics](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/SpellCheck/SpellCheck.html#//apple_ref/doc/uid/10000092i)



---

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)