I want to create an infinite horizontal scrollView but I have a problem. I'm using onAppear for catch item position but it's not working like List because of scrollView firing all views at the beginning.
They added LazyVStack feature to iOS 14 and xCode12 but I need same for iOS 13 xCode 11. Is there any similar solution for this ? Thanks in advance.
ScrollView {
LazyVStack {
ForEach(1...1000, id: \.self) { value in
Text("Row \(value)")
.onAppear(){ print(value) }
}
}
}
My Code :
ScrollView(.horizontal, showsIndicators: false){
HStack(spacing:15){
ForEach(self.viewModel.userSwaps, id: \.id) { swap in
VStack(alignment: .center, spacing: 0){
Text(swap.platform!.name!)
}.frame(width: 115, height: 210).onAppear(){
print(swap.id)
}
}
}.padding(.horizontal, 20)
}.frame(height: 210).id(UUID().uuidString)