---
title: "spellServer(_:checkGrammarIn:language:details:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsspellserverdelegate/spellserver(_:checkgrammarin:language:details:)"
---

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

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

## Declaration

```swift
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 doc://com.apple.foundation/documentation/Foundation/NSSpellServer class for information about these dictionaries.

## Return Value

Return Value Location of the first flagged grammatical unit within string.

## See Also

### Check Grammar and Spelling in Strings

- [spellServer(_:check:offset:types:options:orthography:wordCount:)](foundation/nsspellserverdelegate/spellserver(_:check:offset:types:options:orthography:wordcount:).md)
- [spellServer(_:suggestGuessesForWord:inLanguage:)](foundation/nsspellserverdelegate/spellserver(_:suggestguessesforword:inlanguage:).md)
- [spellServer(_:findMisspelledWordIn:language:wordCount:countOnly:)](foundation/nsspellserverdelegate/spellserver(_:findmisspelledwordin:language:wordcount:countonly:).md)
