Appjeniksaan

Tracking ScrollView offset in SwiftUI

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