質問

So I'm getting ready to implement a spellchecker into my app, and although other people have already asked about how to do this, I couldn't really get a clear picture on the advantages/differences between NSSpellChecker and UITextChecker. Would someone mind just taking a moment to clarify this for me? It seems from the other answers that I have read that UITextChecker is the best thing to use, I'm just trying to make sure I have a complete understanding as to why this is before implementing.

Thanks!!!

役に立ちましたか?

解決

NSSpellChecker is part of AppKit and only available on the Mac, whereas UITextChecker is part of UIKIt and thus only available on iOS. So, depending on which platform you're writing for, you'll need to use the appropriate class for that platform.

他のヒント

For one, UITextChecker returns word completions sorted alphabetically. NSSpellChecker returns the word completions sorted by word frequency.

The (incorrect) docs for completionsForPartialWordRange:inString:language: say:

The strings in the array are in the order they should be presented to the user—that is, more probable completions come first in the array.

UITextChecker word completions for "th":

thalami,
thalamic,
thalamus,
thalassic,
thalidomide,
thallium,
...
the,
...

NSSpellChecker word completions for "th":

the,
this,
that,
they,
thanks,
there,
that's,
...
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top