I have two lists side-by-side. I want to scroll any one of the lists, and the other one can scroll synchronously. Is there any way to achieve the effect? Any help will be appreciated.
struct ScrollTwoListsSynchronously: View {
let dataSet = [1,2,3,4,5]
var body: some View {
HStack{
List{
ForEach(dataSet,id:\.self){data in
Text(String(data))
}
}
.listStyle(PlainListStyle())
List{
ForEach(dataSet,id:\.self){data in
Text(String(data))
}
}
.listStyle(PlainListStyle())
}
}
}