Tengo un campo de texto en swiftUI y, para hacerlo más atractivo, me gustaría agregar un borde y esquinas redondeadas. Pero no parece funcionar como debería (ver imagen). ¿Qué me perdí?

Intenté poner .cornerradius() antes de .border(), pero tuvo el mismo efecto.
TextField("Text input goes here", text: $addMins) .padding(.all, 5.0) .background(View) .frame(width: 300.0, height: 35.0) .border(Color.green, width: 2) .cornerRadius(14)Entonces, ¿quieres algo como esto?
TextField("Text Field", text: $text) .padding(4) .overlay( RoundedRectangle(cornerRadius: 14) .stroke(Color.green, lineWidth: 2) ) .padding()Aquí una manera simple:
struct ContentView: View { @State private var stringOfTextField: String = String() var body: some View { TextField("Enter text . . .", text: $stringOfTextField) .padding() .overlay(RoundedRectangle(cornerRadius: 10.0).strokeBorder(Color.black, style: StrokeStyle(lineWidth: 1.0))) .padding() } }Por cierto, si necesita un campo de texto con un trazo y esquinas redondeadas con un fondo diferente, aquí tiene una solución.
TextField("Placeholder", text: $text) .padding() .background(RoundedRectangle(cornerRadius: 5).fill(Color.gray)) .overlay( RoundedRectangle(cornerRadius: 5) .stroke(lineWidth: 1) ) .foregroundColor(.black)