Tracking ScrollView offset in SwiftUI
Source:
swiftwithmajid.com
—
May 3, 2021
Adding a ScrollView
in SwiftUI is really simple, but that simplicity comes with some limitations. This article from Swift with Majid helped me understand how you can track the current offset in a ScrollView
with a PreferenceKey
.
For more information about using PreferenceKey
, Swift with Majid has you covered with the article: The magic of view preferences in SwiftUI