Claude31, I'm afraid I can't agree with your opinion. Let me describe my requirements, which I believe it's very typical ones and make sense to most, if not all, people:
When specifying .top option, the item to be scrolled to should show up on the top of the screen.
However, if that pushes the items before it outside screen and, at the same time, there are no enough items after it to fill up the screen, SwiftUI should find a proper position to show it.
The above requirements are exactly the behavior of scrollTo() in List. I don't understand why VStack/LazyVStack/LazyVGrid don't implement the same behavior. Why would anyone like to have their current (buggy) behavior? Can you think of any use cases? In my opinion that behavior doesn't make sense at all. If SwiftUI engineers really interpret the .top value that way (I really doubt it), then I think they should introduce another option value to support List like scrolling behavior.
I can't use the code you suggest, because that's not my. purpose. I'd like to scroll to the last item. It's just that SwiftUI should handle the corner cases properly.
Regarding the async call, it's required when navigating to a view.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: