What is the logic of autocapitalizationType and the corresponding global setting?

In the lastest iOS 15 if found the following to be the case regarding the combination of the global autocapitalization setting in the iOS Settings app and the autocapitalizationType property:

| Global setting | autocapitalizationType  | Result (does it capitalize? |
|----------------|-------------------------|-----------------------------|
| on             | Sentences               | yes                         |
| on             | not set                 | no                          |
| off            | Sentences               | no                          |
| off            | not set                 | no                          |

What is the logic behind this?

On a side note, I also believe that in the second row of the above table, we had a 'yes' in earlier versions of iOS.

Accepted Reply

Logic is that it is a && of the 2 conditions. To turn on, you need to authorize globally in settings which then let you select autocapitalizationType.

  • That would mean that as a developer you have to set autocapitalizationType on every single UITextField if you want to respect the user's decision?

  • I tried to set on the UITextField class, with         DispatchQueue.main.async { UITextField.appearance().autocapitalizationType = .words }  in viewDidLoad  but did not succeed yet.

Add a Comment

Replies

Logic is that it is a && of the 2 conditions. To turn on, you need to authorize globally in settings which then let you select autocapitalizationType.

  • That would mean that as a developer you have to set autocapitalizationType on every single UITextField if you want to respect the user's decision?

  • I tried to set on the UITextField class, with         DispatchQueue.main.async { UITextField.appearance().autocapitalizationType = .words }  in viewDidLoad  but did not succeed yet.

Add a Comment

Where did you get the table from your original post ?

You could subclass UITextField and set autocapitalization property as you need.

But that is not really simpler than setting directly the property for each field…

Would that fit your need ?

  • I did create that table in order to illustrate what I found out.

Add a Comment

Ok, I got it. Thanks guys!

I somehow was under the impression that globally turned on auto-capitalization was a feature that should be working by default on any text entry field.