SwiftUI TextField force lowercase

TextField has a .autocapitalization() method.

You can use like this without custom binding:

TextField("URL", text: $url)
                    .keyboardType(.URL)
                    .autocapitalization(.none)

For iOS 15 SwiftUI have a new .textInputAutocapitalization() method:

.textInputAutocapitalization(.never)

This means that any text input by the user will be .lowercased()

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)