In page 169, you said " At the time of writing, the latter option is not well-documented, and the protocol itself has an empty implementation."
Yes, but the form is:
public struct MyTextFieldStyle : TextFieldStyle {
public func _body(configuration: TextField<Self._Label>) -> some View {
configuration
.padding(EdgeInsets(top: 8, leading: 16, bottom: 8, trailing: 16))
.background(Color.white)
.overlay(
RoundedRectangle(cornerRadius: 8)
.stroke(lineWidth: 2)
.foregroundColor(.blue)
)
.shadow(color: Color.gray.opacity(0.4),
radius: 3, x: 1, y: 2)
.padding([.leading, .trailing], 20)
}
}
as in the sample:
using:
TextField("Type your name...", text: $name)
.textFieldStyle(MyTextFieldStyle())