title: ForEach updates view unnecessarily
body: <p>This is my code:</p>
  <pre class="lang-swift prettyprint-override"><code>struct TestPageView: View {
      @State var blocks: [String] = [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;]
      
      var body: some View {
          VStack {
              ForEach(blocks, id: \.self) { block in
                  TestView(block, $blocks)
              }
          }
      }
  }
  
  struct TestView: View {
      @Binding var blocks: [String]
      let block: String
      
      init(_ block: String, _ blocks: Binding&lt;[String]&gt;){
          print(&quot;Created empty view&quot;)
          self.block = block
          self._blocks = blocks
      }
      var body: some View {
          TextField(&quot;Test view&quot;, text: .constant(block), onCommit: {
              print(&quot;Committed&quot;)
              blocks.append(&quot;new element&quot;)
          })
      }
  }
  </code></pre>
  <p>Basic idea is that my ForEach loops over my blocks, showing them. When a user performs an action while a block is focused (<code>onCommit</code> here), I need a new block to be added to the list. This code actually does that correctly; the problem is with performance. With the above print statements, the following is the output:</p>
  <pre><code>Created empty view
  Created empty view
  Created empty view
  Committed
  Created empty view
  Created empty view
  Created empty view
  Created empty view
  </code></pre>
  <p>so it seems the ForEach re-renders all of the items in the list. In this simple example, it's not an issue, but in my real problem, recreating all the <code>TestView</code>s is a large task, and completely unnecessary: I just need the new element to be added, everything else can be left the same. Is there a good way to do this?</p>
  <p><strong>Note</strong>: The <code>\.self</code> is not the issue. I've tried this with making the &quot;blocks&quot; conform to <code>Identifiable</code>. The ForEach still fails to recognize the same ids and still creates the views again.</p>