I have a horizontally scrolling LazyHStack. How do I set the initial scroll position?
In UIKit, I would create a horizontally scrolling UICollectionView and set the collectionView.contentOffset to set the initial scroll position, but I'm not sure how to do this in SwiftUI.
struct ContentView: View {
var body: some View {
ScrollView(.horizontal) {
LazyHStack {
ForEach(1...100, id: \.self) { i in
Text("\(i)")
}
}
}
}
}