SwiftUI TextField – Rounded Border
To set rounded border for TextField, i.e., rounded corners, call textFieldStyle() method on this TextField, and pass RoundedBorderTextFieldStyle() as argument to textFieldStyle() method.
Example
In the following example, we will define a TextField and set its border with rounded corners.
ContentView.swift
import SwiftUI
struct ContentView: View {
@State private var username: String = ""
var body: some View {
TextField(
"Enter username...",
text: $username
)
.disableAutocorrection(true)
.autocapitalization(.none)
.padding(.all)
.textFieldStyle(RoundedBorderTextFieldStyle())
}
}
Screenshot

Summary
Summarising this SwiftUI Tutorial, we learned how to set rounded corners for TextField control.