UITextChecker' rangeOfMisspelledWordInString:range:startingAt:wrap:language:
returns nil if no correction is found. However I was wondering if there's a way to tell if no correction was found because A. It's already correct or B. Nothing Exists for the current word.
This is what I have right now:
if (!arrayOfPossibleCorrections || !arrayOfPossibleCorrections.count) {
//If nothing found bc it's already correct leave it alone
//Else dosomething
} else {
//Replace currentWord with correctWord
}
From Apple developer library,
rangeOfMisspelledWordInString
returns{NSNotFound, 0}
if no misspelled word is found which is exactly what you are asking for.It is
guessesForWordRange
that will return an empty array if no correction is found.In short you should call
guessesForWordRange
only when there is a misspelled word range returned byrangeOfMisspelledWordInString
.