title: DetailView only calls on first item in array when using LazyVGrid
body: <p>I had a list that I could add items to and when I click on them it opened up the correct detail view. I recently swapped the list out for LazyVGrid but when I click on a grid item, the detail view only calls on the first item in the array.</p>
  <p><strong>This is the list view:</strong></p>
  <pre><code>import SwiftUI
  
  struct ListView: View {
  
      @EnvironmentObject var listViewModel: ListViewModel
      @State var addItemView = false
      @State var detailView = false
      
      let columns = [GridItem(.flexible()), GridItem(.flexible())]
  
      var body: some View {
          NavigationView {
              ZStack {
                  ZStack {
                      Color(.white)
                  }
                  VStack {
                      Button(action: {
                          self.addItemView = true
                      }, label: {
                          Text(&quot;Add&quot;)
                      }).sheet(isPresented: $addItemView, content: {
                          AddItemView()
                      })
                      LazyVGrid(columns: columns, spacing: 20) {  // &lt;-- the only line i comment when using list
  //                        List {
                          ForEach(listViewModel.item, id:\.id){ item in
                              Button(action: {
                                  self.detailView = true
                              }, label: {
                                  ListRowView(item: item)
                              }).sheet(isPresented: $detailView, content: {
                                  DetailView(item: item)
                              })
                          }
  //                            .onDelete(perform: listViewModel.deleteItem)
  //                            .onMove(perform: listViewModel.moveItem)
  //                            .listRowBackground(Color.blue)
                      }
  //                        .listStyle(PlainListStyle())
                      Spacer()
                  }
              }
          }
      }
  }
  
  struct ListRowView: View {   // &lt;-- using this as grid item
      @State var item:Item
  
      var body: some View{
          VStack {
              Text(item.name).foregroundColor(.white)
          }.frame(width: 150, height: 150, alignment: .center)
          .background(Color.blue)
          .cornerRadius(10)
      }
  }
  </code></pre>
  <p><strong>The add item and detail view:</strong></p>
  <pre><code>struct AddItemView: View {
      @Environment(\.presentationMode) var presentationMode
      @EnvironmentObject var listViewModel: ListViewModel
      @State var id = UUID()
      @State var name = &quot;&quot;
  
      var body: some View {
          TextField(&quot;Enter Name&quot;, text: $name)
          Button(action: {
              addItem()
          }, label: {
              Text(&quot;Done&quot;)
          })
      }
  
      func addItem() {
          listViewModel.addItem(id: id.uuidString, name: name)
          presentationMode.wrappedValue.dismiss()
      }
  }
  
  struct DetailView: View {
      @State var item:Item
  
      var body: some View {
          Text(item.name)
      }
  }
  </code></pre>
  <p><strong>And this is how im adding each item:</strong></p>
  <pre><code>import Foundation
  
  struct Item: Hashable, Codable, Equatable {
      var id:String
      var name: String
  }
  
  class ListViewModel: ObservableObject {
  
      @Published var item: [Item] = [] {
          didSet {
              saveItem()
          }
      }
  
      let itemsKey: String = &quot;items_key&quot;
  
      init() {
          getItems()
      }
  
      func getItems() {
          guard
              let data = UserDefaults.standard.data(forKey: itemsKey),
              let savedItems = try? JSONDecoder().decode([Item].self, from: data)
          else { return }
      
          self.item = savedItems
      }
  
      func deleteItem(indexSet: IndexSet){
          item.remove(atOffsets: indexSet)
      }
  
      func moveItem(from: IndexSet, to: Int){
          item.move(fromOffsets: from, toOffset: to)
      }
  
      func addItem(id: String, name: String){
          let newItem = Item(id: id, name: name)
          item.append(newItem)
          print(newItem)
      }
  
      func saveItem() {
          if let encodedData = try? JSONEncoder().encode(item) {
              UserDefaults.standard.set(encodedData, forKey: itemsKey)
          }
      }
  }
  </code></pre>
  <p>I'm not sure why the LazyVGrid is only calling on the first item, any help would be appreciated</p>