How do you select items in a grid view ? There appears to be no equivalent to List(selection:)
SwiftUI Grid View
Add a Comment
Code Block swift struct ContentView: View { @State var selectedItem = 0 var body: some View { ScrollView { LazyVGrid(columns: Array(repeating: GridItem(.flexible()), count: 3)) { ForEach((0...100), id: \.self) { item in Rectangle() .fill(item == selectedItem ? Color.blue : Color.gray) .aspectRatio(1.0, contentMode: .fit) .onTapGesture { selectedItem = item } } } } } }