This code has a behavior that I think might be a bug, but I wanted to check to see if anyone spots a flaw in my thinking.
This code makes a scrollable containing a single view which itself encapsulated a longer-than-the-screen list. Note the UnitPoint on line 9, the y: component seems to be a percentage.
The bug is that the point requested must be on the screen. In this case, it seems to be around the 12, but with different numbers I get different results.
The only time it seems to be consistent is if the current scroll position is at the very top.
This code makes a scrollable containing a single view which itself encapsulated a longer-than-the-screen list. Note the UnitPoint on line 9, the y: component seems to be a percentage.
The bug is that the point requested must be on the screen. In this case, it seems to be around the 12, but with different numbers I get different results.
The only time it seems to be consistent is if the current scroll position is at the very top.
Code Block import SwiftUI struct ListVsScrollview: View { var body: some View { NavigationView { ScrollViewReader { sv in VStack{ Button("Move") { sv. ;sv.scrollTo(72, anchor: UnitPoint(x: 0.0, y: 0.1)) } ScrollView { VStack { Text("Hi").font(.title) ForEach(0...100, id: \.self) { number in Text("\(number)").font(.title) } Text("Low").font(.title) }.id(72) } .navigationBarItems(trailing: EditButton()) } } } } } struct ListVsScrollview_Previews: PreviewProvider { static var previews: some View { ListVsScrollview() } }