title: SwiftUI: Deleting last row in ForEach
body: <p>I am trying to remove rows inside a <code>ForEach</code>. Removing the last row always throws an index out of range exception. Removing any other row does not.</p>
  
  <pre><code>ForEach(Array(player.scores.enumerated()), id: \.element) { index, score in
      HStack {
          if self.isEditSelected {
              Button(action: {
                  self.player.scores.remove(at: index)
              }, label: {
                  Image("delete")
              })
          }        
          TextField("\(score)", value: self.$player.scores[index], formatter: NumberFormatter())
      }
  }
  </code></pre>
  
  <p>I have tried using <code>ForEach(player.indices...)</code> &amp; <code>ForEach(player.scores...)</code>, but see the same problem.</p>
  
  <p>Looks to me like the crash happens here <code>self.$player.scores[index]</code>, as hardcoding the index to any value other that the last row is working. </p>
  
  <p>Does anyone know how to fix this? Or if there is a better approach.</p>