.scrollPosition(id: $dataID) doesn't work at all

I have tried the codes in this page https://developer.apple.com/forums/thread/731271?answerId=755458022#755458022

.scrollPosition(id: $dataID) is supposed to keep the current ScrollView position.

However, none of them work.

I use Xcode 15.3. Tested on iOS 17.0.1 and iOS 17.4 simulators.

The people in the page talk like it works for appending, not for prepending. But in my tests, none of them keeps the scroll position. The scroll view will scroll to other part, without changing the dataID. It will update the dataId to the current value only when I scroll manually.

Post not yet marked as solved Up vote post of HaiFengKao Down vote post of HaiFengKao
174 views