<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSSpellServerDelegate/spellServer(_:checkGrammarIn:language:details:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSSpellServerDelegate(im)spellServer:checkGrammarInString:language:details:"
  },
  "title" : "spellServer(_:checkGrammarIn:language:details:)"
}
-->

# spellServer(_:checkGrammarIn:language:details:)

Gives the delegate the opportunity to customize the grammatical analysis of a given string.

```
optional func spellServer(_ sender: NSSpellServer, checkGrammarIn stringToCheck: String, language: String?, details: AutoreleasingUnsafeMutablePointer<NSArray?>?) -> NSRange
```

## Parameters

`sender`

Spell server satisfying a grammatical analysis request.

`stringToCheck`

String to analyze.

`language`

Language use in `string`. When `nil`, the language selected in the Spelling panel is used.

`details`

On output, dictionaries describing grammar-analysis details within the flagged grammatical unit. See the [`NSSpellServer`](/documentation/Foundation/NSSpellServer) class for information about these dictionaries.

## Return Value

Location of the first flagged grammatical unit within `string`.

---

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)