scroll

How do I correctly pass a “cell item” to a .sheet from a SwiftUI LazyVGrid?

浪子不回头ぞ 提交于 2020-11-25 03:40:33
问题 Here is my example, and I can't tell if this is a bug or not. All my cells load correctly, but when I try to bring up the DetailView() as a sheet, the item pased in is always whatevr item is shown first in the grid (in the top left in my case here), NOT the "cell" that was tapped. So, why is the item from ForEach loop correctly populating the cells, but not being passed to the .sheet via the button? import SwiftUI let columnCount: Int = 11 let gridSpacing: CGFloat = 1 struct GridView: View {