title: Pass state/binding to UIViewRepresentable
body: <p>What is the correct way to pass a state variable to my custom text field? I was hoping to avoid other approaches/observables. Shouldn't this work?</p>
  
  <p>I have recreated the problem below in an example project.</p>
  
  <pre><code>import SwiftUI
  
  struct ParentView: View {
      @State var text: String = "initial"
      var body: some View {
          VStack {
              ChildView(text: $text)
              Text(self.text)
          }
      }
  }
  struct ChildView: View {
      @Binding var text: String
      var body: some View {
          MyTextField(text: $text).frame(width: 300, height: 40, alignment: .center)
      }
  }
  
  struct MyTextField: UIViewRepresentable {
      @Binding var text: String
      func makeUIView(context: Context) -&gt; UITextField {
          let view = UITextField()
          view.borderStyle = UITextField.BorderStyle.roundedRect
          return view
      }
      func updateUIView(_ uiView: UITextField, context: Context) {
          uiView.text = text
      }
  }
  </code></pre>