我为 UITextField 创建了一个 UIViewRespresentable。我想应用修饰符:
myTextField.font(.headline).keyboardType(keyboardType)
这不起作用,即使我的 UIViewRepresentable 很简单:
class MyTextField: UITextField { ... }
struct MyFieldField: UIViewRepresentable {
private let field = MyTextField()
func makeUIView(context: Context) -> MyTextField { return field }
func updateUIView(_ uiView: MyTextField, context: Context) {
...
}
}