Toggling UITextView attributes for spellchecking, smart quotes, etc stops working

I've added some menu actions to toggle various text view attributes named in the subject. The default for Simulator and my devices is to have these features turned on. But I'm finding that toggling them in my menu actions doesn't actually work.

Toggling spellchecking or smart quotes (I haven't yet bothered to add more actions and test them) to .off does indeed set the correct value on the UITextView, but the features are still happening when I type (soft or hard keyboards behave the same).

What's wrong? Is it simply broken and is caching the initial value or something? 18.4 is being used on my Simulator and my devices. I also tried 18.3.1 in Simulator with the same results.

Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

I have a pared down project I can post, however I found one thing, and I'm not sure if it's supposed to work this way or not. I'm guessing not.

I'd expect this to work, and it does:

  1. Load the text view from storyboard. Editing is not active.
  2. Change the smartQuotesType (or any other attr).
  3. Activate editing.
  4. The correct setting of smartQuotesType is used.

I'd expect this to work too, but it does not:

  1. Load the text view from storyboard. Editing is not active.
  2. Activate editing.
  3. Change the smartQuotesType (or any other attr).
  4. Typing will use the value it was set to prior to activating editing.

I'd expect this to work in both cases, but only the first works:

  1. Load the text view from storyboard. Editing is not active.
  2. Change the smartQuotesType (or any other attr).
  3. Activate editing.
  4. The correct setting of smartQuotesType is used.
  5. Change the smartQuotesType (or any other attr).
  6. Typing will still use the value it was changed to prior to activating editing.

If changing the attributes should work in all cases above, let me know and I'll post the project.

I went ahead and submitted FB17280866. I came here first to just see if I was trying to do something that UITextView is not capable of doing.

Toggling UITextView attributes for spellchecking, smart quotes, etc stops working
 
 
Q