iosswiftswift-keyboard

Prevent Autocorretion of a Word in Swift


My client's chat app is autocorrected whenever it is mentioned in UITextViews within the app. So if it's called XYZ (just making this up) whenever users type XYZ in a UITextView in the app, it tries to autocorrect it.

I know this is a small/petty thing, but he feels like it's embarrassing to see the app's name try to be changed for users of it, if that makes sense.

Any chance I could have that specific word ignored for the UITextView inside the actual app? Or does this require modifying the user's SwiftKey or something on a per-user basis to avoid?

Thanks for any help / direction anyone can provide!


Solution

  • You can use UITextChecker in the root view controller's viewDidLoad()

    UITextChecker.learnWord("xyz")