I would like to turn off predictive text/autocorrect for a TextField
in SwiftUI. Looks like this was possible with UITextField
:
Disable UITextField Predictive Text
I checked the Apple documentation for TextField
and googled, but can't find anything about this.
Has anyone found a way to disable the predictive text/autocomplete for a TextField?
Seems like it is now possible using Xcode 11 Beta 5. There is a new modifier to disable the autocorrection on TextField
func disableAutocorrection(_ disable: Bool?) -> some View
Edit: Modifier disableAutocorrection is deprecated in iOS 16.1. The new modifier is autocorrectionDisabled:
func autocorrectionDisabled(_ disable: Bool = true) -> some View