TextField by default auto corrects values entered by users according to their locale but if you need to disable this feature then use disableAutocorrection modifier for that purpose. TextFields where you are expecting user’s to enter their first name, last name or username can be some examples where you may want to disable auto correct feature.
struct TextFieldExample: View {
@State private var title: String = ""
@State private var category: String = ""
@State private var type: String = ""
var body: some View {
VStack {
Text("DevTechie Courses")
.font(.largeTitle)
VStack(alignment: .leading) {
Text("Enter new course title")
.font(.title3)
TextField("Course title", text: $title)
.textFieldStyle(.roundedBorder)
.disableAutocorrection(true)
TextField("Course category", text: $category)
.textFieldStyle(.roundedBorder)
TextField("Course type", text: $type)
.textFieldStyle(.roundedBorder)
.disableAutocorrection(true)
}.padding(.top, 20)
}.padding()
}
}