I have an editable UITextView that loads with the String attribute. This String attribute is loaded by the user attributes set by the application. For this reason, I always add these custom attributes to the typingAttributes textView.
Whenever I type, it works as expected, the added text has custom attributes set, but whenever I use predictive sentences to replace a word, the whole word is set without custom attributes.
As far as I know, every time the attribute text is set programmatically, typingAttributes automatically cleared. Therefore, it seems that when choosing a predictive offer, the text is set programmatically, and for this reason I lose all my user attributes.
Is there any way around this?
ios swift uitextview nsattributedstring
Afonso
source share