In the recent WWDC 2020, Apple introduced ScrollViewReader. This is one of the features that a lot of us have been looking forward to due to the lack of support that was found for scrolling in SwiftUI 1.

As many of us are aware, there wasn’t any built-in support to scroll to a specific row in SwiftUI 1. There’s probably multiple different hacky ways of doing it with a bunch of code written by different people on Stack Overflow, but isn’t it a lot better if it can be done with just a line of code?

With ScrollViewReader, you’ll now be able to scroll to any row with the use of index.

Note: The same behavior doesn’t work for List. Jumping to an element in a List doesn’t seem to be supported at the time of publication.

#swift #ios #programming #mobile #swiftui

Scroll to Different Positions in a ScrollView With ScrollViewReader in SwiftUI 2
6.85 GEEK