I have the problem that in the example the scrollto function doesn’t work the first time the list expands over the bottom edge. After scrolling to the bottom it is working again. Perhaps these examples helps to find the underlying problem, which I can’t figure out:
when removing the most inner VStack it is working the first time
When putting a text for example over the adding button and giving a high enough height of frame it is also working the first time
struct ContentView: View{ @State var sp = [1,2,3,4,5] var body: some View{ VStack{ Text("asdf") .frame(height: 90) ScrollView{ ScrollViewReader{scrollReader in VStack{ VStack{ ForEach(sp,id:\.self){p in Text("\(p)").frame(height: 50) } } Button("add"){ sp.append((sp.last ?? 0) + 1) } Spacer(minLength: 60) .id("bottom") } .frame(maxWidth: .infinity) .border(Color.green) .onChange(of: sp.count){_ in scrollReader.scrollTo("bottom") } } } .border(Color.black) } } }