SwiftUI TextField – Change Border Width
To change border width of TextField, call border() method on this TextField, and specify the width parameter.
Example
In the following example, we will change the border width of TextField to 4.
ContentView.swift
import SwiftUI
struct ContentView: View {
@State private var username: String = ""
var body: some View {
TextField(
"Enter...",
text: $username
)
.padding(.all)
.border(Color(UIColor.separator), width: 4)
.padding(.all)
}
}
Screenshot

Now, let us change the border width to some other value, say 8, and observe the output.
ContentView.swift
import SwiftUI
struct ContentView: View {
@State private var username: String = ""
var body: some View {
TextField(
"Enter...",
text: $username
)
.padding(.all)
.border(Color(UIColor.separator), width: 8)
.padding(.all)
}
}
Screenshot

Summary
Summarising this SwiftUI Tutorial, we learned how to change the border width for TextField control.