<!--
{
  "availability" : [
    "iOS: 3.2.0 -",
    "iPadOS: 3.2.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextChecker/rangeOfMisspelledWord(in:range:startingAt:wrap:language:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITextChecker(im)rangeOfMisspelledWordInString:range:startingAt:wrap:language:"
  },
  "title" : "rangeOfMisspelledWord(in:range:startingAt:wrap:language:)"
}
-->

# rangeOfMisspelledWord(in:range:startingAt:wrap:language:)

Initiates a search of a range of a string for a misspelled word.

```
func rangeOfMisspelledWord(in stringToCheck: String, range: NSRange, startingAt startingOffset: Int, wrap wrapFlag: Bool, language: String) -> NSRange
```

## Parameters

`stringToCheck`

The string to check for misspelled words.

`range`

The range of `stringToCheck` to check for a misspelled word.

`startingOffset`

The offset within `range` of `stringToCheck` to begin checking for misspelled words.

`wrapFlag`

<doc://com.apple.documentation/documentation/Swift/true> to continue checking from the beginning of `range` if no misspelled word is found between `startingOffset` and the end of `range`. Specify <doc://com.apple.documentation/documentation/Swift/false> to have spell-checking end at the end of `range`.

`language`

The language of the of words to be checked for correct spelling. This string is a ISO 639-1 language code or a combined ISO 639-1 language code and ISO 3166-1 regional code (for example, `fr_FR`).

## Return Value

The range of the first misspelled word encountered or `{NSNotFound, 0}` if none is found.

## Discussion

To search an entire string or a range within that string, call this method in a loop, resetting `startingOffset` from each returned range, until you reach the end of the string or specified range within the 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)