Prevents the first letter from becoming uppercase when entering the alphabet in the TextField

problem

When creating a screen using TextField, the first letter may be automatically capitalized when inputting. Especially when checking the operation of the screen using Canvas, if it is input from the keyboard, there is no way to convert uppercase letters to lowercase letters, which is painful. ezgif.com-gif-maker.gif

Solutions

You can use Autocapitalization (_ :), which is the Modifiers of TextField, to control the automatic conversion to uppercase.

https://developer.apple.com/documentation/swiftui/textfield/autocapitalization(_:)

TextField("username", text: $vm.userName)
    .autocapitalization(.none)
TextField("mail address", text: $vm.emailAddress)
    .autocapitalization(.none)

ezgif.com-gif-maker (1).gif

Recommended Posts

Prevents the first letter from becoming uppercase when entering the alphabet in the TextField
Install lsb_release from the command line when lsb_release fails in docker environment