title: SwiftUI - does ForEach have a endIndex or lastindex?
body: <p>I'm using ForEach to create a loop. However, I want to render a Rectangle conditionally depending upon the count of the loop. For example, don't render the rectangle if the last loop iteration.</p>
  
  <p>What's the correct syntax for this?</p>
  
  <p>I'm looking for something like this (non working pseudo-code)</p>
  
  <pre class="lang-swift prettyprint-override"><code>ForEach(arrayOfThings, id: \.title) { thing in
      // Stuff that happens on every iteration of loop
  
      // Conditional section
      if (thing.endIndex-1) {
          Rectangle()
          .frame(width: 100, height: 1, alignment: .bottom)
          .foregroundColor(Color("666666"))
      }
  }
  </code></pre>
  
  <p>I am aware there are things like <code>for (offset, element) in array.enumerated() { }</code> but you can't use them in views. I wondered if there is a convenience feature in ForEach to solve this need?</p>
  
  <p>Currently I am doing this to workaround:</p>
  
  <pre class="lang-swift prettyprint-override"><code>ForEach(0..&lt;arrayOfThings.count) { i in
      // Stuff that happens on every iteration of loop
  
      // Conditional section
      if (i = self.arrayOfThings.count-1) {
          Rectangle()
          .frame(width: 100, height: 1, alignment: .bottom)
          .foregroundColor(Color("666666"))
      }
  }
  </code></pre>