<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSpellChecker/checkSpelling(of:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSpellChecker(im)checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:"
  },
  "title" : "checkSpelling(of:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:)"
}
-->

# checkSpelling(of:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:)

Starts the search for a misspelled word in a string starting at specified offset within the string.

```
func checkSpelling(of stringToCheck: String, startingAt startingOffset: Int, language: String?, wrap wrapFlag: Bool, inSpellDocumentWithTag tag: Int, wordCount: UnsafeMutablePointer<Int>?) -> NSRange
```

## Parameters

`stringToCheck`

The string object containing the words to spellcheck.

`startingOffset`

The offset within `stringToCheck` at which to begin spellchecking.

`language`

The language of the words in the string. If `language` is `nil`, or if you obtain the value by sending [`language()`](/documentation/AppKit/NSSpellChecker/language()) to `self`, the current selection in the Spelling panel’s pop-up menu is used. Do not pass in an empty string for `language`.

`wrapFlag`

<doc://com.apple.documentation/documentation/Swift/true> to indicate that spell checking should continue at the beginning of the string when the end of the string is reached; <doc://com.apple.documentation/documentation/Swift/false> to indicate that spellchecking should stop at the end of the document.

`tag`

An identifier unique within the application used to inform the spell checker which document that text is associated, potentially for many purposes, not necessarily just for ignored words. A value of 0 can be passed in for text not associated with a particular document.

`wordCount`

Returns by indirection a count of the words spell-checked up to and including the first error (if any), or -1 if the spell checker fails or does not support word counting. Specify `NULL` if you do not want this word count.

## Return Value

The range of the first misspelled word and optionally (and by reference) the count of words spellchecked in the string in `wordCount`.

---

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)