title: how can i get the even index object in a list useing swift 5?
body: <pre><code>import SwiftUI
  
  struct Videolist: View {
      @EnvironmentObject var modelData: ModelData
      static var videolist = ModelData().videolist
      @State private var j  = 0
      var total = Videolist.videolist.count
      var body: some View {
          NavigationView {
              List {
                  ForEach(Videolist.videolist.indices) { i in
                  NavigationLink(destination: videoinfo(video: Videolist.videolist[i])) {
                      if i &lt; 10 {
                          videoblock(video1: Videolist.videolist[i],video2: Videolist.videolist[i+1])
                      }
              }
              }
          }
          .navigationTitle(&quot;video&quot;)
          }
      }
  }
  
  struct videolist_Previews: PreviewProvider {
      static var previews: some View {
          Videolist()
              .environmentObject(ModelData())
      }
  }
  </code></pre>
  <p>I am trying to learn swift5 myself, anyBody can. explain to be why to code up work, but the code below does not work?</p>
  <pre><code>import SwiftUI
  
  struct Videolist: View {
      @EnvironmentObject var modelData: ModelData
      static var videolist = ModelData().videolist
      @State private var j  = 0
      var total = Videolist.videolist.count
      var body: some View {
          NavigationView {
              List {
                  ForEach(Videolist.videolist.indices) { i in
                  NavigationLink(destination: videoinfo(video: Videolist.videolist[i])) {
                      if j &lt; 10 {
                          videoblock(video1: Videolist.videolist[i],video2: Videolist.videolist[i+1])
                          j += 1
                      }
              }
              }
          }
          .navigationTitle(&quot;video&quot;)
          }
      }
  }
  
  struct videolist_Previews: PreviewProvider {
      static var previews: some View {
          Videolist()
              .environmentObject(ModelData())
      }
  }
  
  </code></pre>
  <p>I want to set two video cover in one line
  by check if j is even, then set a NavigationLink,like this:
  <a href="https://i.stack.imgur.com/eMwG3.jpg" rel="nofollow noreferrer">enter image description here</a></p>