title: How binding between computed property in model and view's @Binding property in SwiftUI
body: <p>I trying make a API Tester app about restful. my model stored a few property， scheme protocol like “http”，host like “www.google.com”，path like “/search” and query parameter like “?q=keyword”.
  and a computed property about URL string ，it joined from above stored propertys.</p>
  <pre><code>class ModelStore: ObservableObject {
          
          @Published var scheme = “http”
          @Published var host = &quot;&quot;
          @Published var port = &quot;80&quot;
          @Published var path = &quot;&quot;
          @Published var query = &quot;&quot; 
          
          var urlString: String {
              get {
                  var tempUrl: String
                  tempUrl =  scheme + “://” + host + &quot;:&quot; + port + &quot;?&quot; + query
                  return tempUrl
              }
              set {
                  guard let url = URL(string: newValue) else {
                      return
                  }
                  scheme = url.scheme ?? &quot;&quot;
                  host = url.host ?? &quot;&quot;
                  path = url.path
                  query = url.query ?? &quot;&quot;
              }
          }
      
          var parametersArray: [String] {
              get {
                  query.components(separatedBy: &quot;&amp;&quot;)
              }
              set {
                  query = newValue.joined(separator: &quot;&amp;&quot;)
              }
          }
          
          var paramStruct: [ParaStruct] {
              get {
                  var params = [ParaStruct]()
                  parametersArray.forEach { (str) in
                      let item = str.components(separatedBy: &quot;=&quot;)
                      if item.count &gt; 1 {
                          params.append(ParaStruct(key: item[0], value: item[1]))
                      }
                  }
                  return params
              }
              set {
                  var newQuery = [String]()
                  newValue.forEach { (value) in
                      let item = value.key + &quot;=&quot; + value.value
                      newQuery.append(item)
                  }
                  query = newQuery.joined(separator: &quot;&amp;&quot;)
              }
          }
      }
  
  class ParaStruct: Identifiable, ObservableObject{
      var id = UUID()
      static func == (lhs: ParaStruct, rhs: ParaStruct) -&gt; Bool {
          lhs.key == rhs.key &amp;&amp; lhs.value == rhs.value
      }
      @Published var key: String = &quot;&quot;
      @Published var value: String = &quot;&quot;
      init(key: String, value: String) {
          self.key = key
          self.value = value
      }
  }
  
  struct ContentView: View {
      @ObservedObject var modelStore = ModelStore()
      var body: some View {
          GeometryReader { geometryProxy in
              VStack(spacing: 0) {
                  TextField(&quot;URL&quot;, text: self.$modelStore.urlString) 
                  TextField(&quot;Host&quot;, text: self.$modelStore.host)
                  TextField(&quot;Port&quot;, text: self.$modelStore.portString)
                  TextField(&quot;Path&quot;, text: self.$modelStore.path)
                  TextField(&quot;Query Parameters&quot;, text: self.$modelStore.query)
                  
                  List(self.modelStore.paramStruct) { (param) in
                      TextField(&quot;value&quot;, text: Binding(get: {
                          param.value
                      }, set: { (value) in
  
  //this textfield doesn't work in here
                          param.value = value
                      }))
                  }
              }
          }
      }
  }
  
  </code></pre>
  <p>everything is OK so far，but the textfield in List doesn't work. it can read update from model，but can't write textfield‘s change to model，result in other view doesn't change sync.</p>
  <pre><code>set: { (value) in
  //this textfield doesn't work in here
                    param.value = value
       }
  </code></pre>
  <p>what problem with it？ maybe I understand wrong？anyone help me？</p>