Usage example:
- Add a property to track the state of the
ScrollView
@ScrollState var state
- Use the
scrollViewStyle
modifier.scrollViewStyle(.defaultStyle($state))
TestView
struct TestView: View {
@ScrollState var state
var body: some View {
ScrollView {
...
}.scrollViewStyle(.defaultStyle($state))
.onChange(of: state.isDragging) { newValue in
print(newValue)
}
}
}