Search code examples
iosswiftkeyboardtextfield

How to make keyboard uppercase?


I need the keyboard to be with CapsLock on (please don't answer how to make text in textField uppercased):

enter image description here


Solution

  • You need to specify .autocapitalizationType for your textField in viewDidLoad or somewhere else during setup of the view like so:

    override func viewDidLoad() {
        super.viewDidLoad()
        
        textField.autocapitalizationType = .allCharacters
    }
    

    Now when your textField becomes active, your keyboard will be on caps.

    Here are all the possible options for autocapitalizationType.