autocorrectionDisabled(_:)
Sets whether to disable autocorrection for this view.
Declaration
nonisolated func autocorrectionDisabled(_ disable: Bool = true) -> some View
Parameters
- disable:
A Boolean value that indicates whether autocorrection is disabled for this view. The default value is
true.
Discussion
Use this method when the effect of autocorrection would make it more difficult for the user to input information. The entry of proper names and street addresses are examples where autocorrection can negatively affect the user’s ability complete a data entry task.
The example below configures a TextField with the default keyboard. Disabling autocorrection allows the user to enter arbitrary text without the autocorrection system offering suggestions or attempting to override their input.
TextField("1234 Main St.", text: $address)
.keyboardType(.default)
.autocorrectionDisabled(true)See Also
Managing text entry
autocorrectionDisabledkeyboardType(_:)scrollDismissesKeyboard(_:)textContentType(_:)textInputAutocapitalization(_:)TextInputAutocapitalizationtextInputCompletion(_:)textInputSuggestions(_:)textInputSuggestions(_:content:)textInputSuggestions(_:id:content:)textContentType(_:)textContentType(_:)textContentType(_:)TextInputFormattingControlPlacement