I'm trying to set the initially visible item LazyGrid (swiftUI)
The idea is instead of the initial value be the default (0)
the initial value became the value I chose, for instance 4
with the possibility of move the grid to 0 and to 9.
I have simple grid
import SwiftUI
struct ContentView: View {
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
LazyHGrid(rows: [GridItem(.flexible(minimum: 200, maximum: 200))]) {
ForEach(0 ..< 10){ val in
ZStack{
Rectangle()
.foregroundColor(.gray)
.frame(width: 200, height: 200)
Text("\(val)")
.fontWeight(.bold)
.font(.title)
.foregroundColor(.white)
}
}
}
}
}
}


