2

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!

NullHypothesis
  • 4,286
  • 6
  • 37
  • 79
  • Are you talking within other apps or within the app you are working on ? – Harsh May 01 '20 at 04:20
  • 1
    @Harsh Citing the post "Any chance I could have that specific word ignored for the UITextView **inside the actual app**?" – Renzo Tissoni May 01 '20 at 04:34
  • In the app delegate you can use the UITextChecker API to learn a new word within your own app and will be applied to all the other apps too. – Harsh May 01 '20 at 04:51

2 Answers2

3

A very well documented tutorial about UITextChecker given by NSHipster blog.

You should focus on the Learning a New word Section of the blog, which should give you answer

Just for the sake if people don't want to jump around links

Let’s assume that you want your users to be able to type "xyz" exactly. Let your app know that by telling it to learn the word, using the UITextChecker.learnWord(_:) class method:

let someNewWordTheAppNeedsToLearn = "xyz"    
UITextChecker.learnWord(someNewWordTheAppNeedsToLearn)

I believe you can create a wrapper class exclusively for making app learn words and call it in your app delegate.

Apple Documentation

Harsh
  • 2,852
  • 1
  • 13
  • 27
2

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

UITextChecker.learnWord("xyz")
elliott-io
  • 1,394
  • 6
  • 9