scrollInputBehavior(_:for:)
Enables or disables scrolling in scrollable views when using particular inputs.
Declaration
@MainActor @preconcurrency func scrollInputBehavior(_ behavior: ScrollInputBehavior, for input: ScrollInputKind) -> some View
Parameters
- behavior:
Whether scrolling should be enabled or disabled for this input.
- input:
The input for which to enable or disable scrolling.
Discussion
In contrast to scrollDisabled(_:), this modifier will enable or disable scrolling only for particular inputs. The following, for instance, disables double-tap-to-scroll on watchOS while preserving the ability to scroll via touch and the Digital Crown:
ScrollView(...)
.scrollInputBehavior(.disabled, for: .handGestureShortcut)If scrollDisabled(true) has been applied to this view, scrolling will be disabled for all inputs and this modifier cannot be used to re-enable scrolling.