.textFieldStyle(_:) 方法不是只能用在 TextField 上,它也可以用在 parent view 上面❗️
// ⭐️ parent view 使用 .textFieldStyle() 才不會失去 context。 view.textFieldStyle(.roundedBorder) // ⭐️ text field 可使用 custom method,使語意更簡潔。 textField.style(.roundedBorder) // custom method
👉 see: textField.style(_:)
SwiftUI ⟩ Views and Controls ⟩ TextField ⟩
TextFieldStyle
textField.textFieldStyle(_:)
SwiftOnTap ⟩
TextFieldStyle (protocol)
view.textFieldStyle(_:)
Sundell ⟩ Encapsulating SwiftUI view styles
Last updated 2 years ago