我有一个SwiftUI的Content View类,我想实现KeyBoard避免使用它,我想通过为其分配一些类来实现这一点 我有避免键盘类 现在如何将其分配给textField的View或Backview以实现此类功能 就像您以前在故事中所做的那样 这个想法是为了达到避免键盘进入的效果。我想将此文件包含到我的VStack中 这是github link
的链接#My Code Below
```
struct ContentView : View {
// @ObservedObject private var kGuardian = KeyboardGuardian(textFieldCount: 1)
@State var name: String = ""
@State var pwd: String = ""
var body: some View {
VStack(){
Group{
TextField("UserName", text: $name).padding(20)
TextField("Password", text: $pwd).padding(20)
}.background(Color.white)
.clipShape(RoundedRectangle(cornerRadius: 5))
.shadow(radius: 5)
}
}
}
}
```
I am trying with this below code to achieve my Functionality.
How Do You Achieve this?
```
struct TextField: UIViewRepresentable {
//var exposed to SwiftUI object init
func makeUIView(context: UIViewRepresentableContext<SATextField>) -> WrappableTextField {
}
func updateUIView(_ uiView: WrappableTextField, context: UIViewRepresentableContext<SATextField>) {
}
}
```