Has mentionned by @archy88 for me replacing inner VStack with LazyVStack did fix the issue.
Expect that will help some of you.
ScrollViewReader { scrollProxy in
ScrollView(.vertical) {
VStack (spacing: 0) {
ForEach(parents) { parent in
Text(parent.name)
.padding()
LazyVStack (spacing: 0) { // With VStack Scroll issue
ForEach(parent.childs) { child in
ChildView(child)
.id(child.uuid)
.padding()
}
}
.id(parent.id)
}
}
Spacer()
}
.onAppear() {
if let selectedChild = selectedChild {
scrollProxy.scrollTo(selectedChild.uuid, anchor: .center)
}
}
}
.padding()
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: