---
title: "guesses(forWordRange:in:language:inSpellDocumentWithTag:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsspellchecker/guesses(forwordrange:in:language:inspelldocumentwithtag:)"
---

# guesses(forWordRange:in:language:inSpellDocumentWithTag:)

Returns an array of possible substitutions for the specified string.

## Declaration

```swift
func guesses(forWordRange range: NSRange, in string: String, language: String?, inSpellDocumentWithTag tag: Int) -> [String]?
```

## Parameters

- `range`: The range of the string to check.
- `string`: The string to guess.
- `language`: The language of the string.
- `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.

## Return Value

Return Value An array of strings containing possible replacement words.

## See Also

### Checking Strings for Spelling and Grammar

- [countWords(in:language:)](appkit/nsspellchecker/countwords(in:language:).md)
- [checkSpelling(of:startingAt:)](appkit/nsspellchecker/checkspelling(of:startingat:).md)
- [checkSpelling(of:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:)](appkit/nsspellchecker/checkspelling(of:startingat:language:wrap:inspelldocumentwithtag:wordcount:).md)
- [checkGrammar(of:startingAt:language:wrap:inSpellDocumentWithTag:details:)](appkit/nsspellchecker/checkgrammar(of:startingat:language:wrap:inspelldocumentwithtag:details:).md)
- [check(_:range:types:options:inSpellDocumentWithTag:orthography:wordCount:)](appkit/nsspellchecker/check(_:range:types:options:inspelldocumentwithtag:orthography:wordcount:).md)
- [requestChecking(of:range:types:options:inSpellDocumentWithTag:completionHandler:)](appkit/nsspellchecker/requestchecking(of:range:types:options:inspelldocumentwithtag:completionhandler:).md)
