Post

Replies

Boosts

Views

Activity

Reply to LazyVGrid and ScrollViewReader
It works for me. I use the id modifier to set ids of LazyVGrid children. Here is my code: ScrollView {             ScrollViewReader { scroller in                  LazyVGrid(columns: columns) {                      ForEach((0..<itemCount), id: \.self) { index in let someText = ...                          Text(someText)                              .id(index)                      }                  }                  .onAppear { let targetId = 10                      scroller.scrollTo(targetId, anchor: .top)                  }             }         }
Dec ’21