Disable scrolling in SwiftUI List?

Hi, is it possible to disable scrolling behavior in the SwiftUI List view? I'd like to take advantage of the new grouping features

Code Block
List(content, children: \.children) 

in List and want the list to be part of a larger scrolling view. As it stands I get an embedded scroll view for the list which is not my intent.
Thanks!
  • Did you find a way to get this working? I am trying to do the same thing to use the new .swipeActions modifier.

Add a Comment

Replies

List{ ... }.disabled(true)

I have been attempting to do the same thing but am also stuck.

I have an image and some text at the top of the screen with a list underneath. All of this is embedded inside a ScrollView. Using GeometryReader lets the list look as it would do normally but now I have 2 separate views that scroll independently.

.disabled(true) resolves the UI issues but removes the functionally of the list which contains NavigationLinks and DisclosureGroups.

I know this is an old thread but I found it looking for an answer and based on the view count I am not the only one. This keeps things like NavigationLinks working while disabling scroll. Here is a solution:

List{...}.simultaneousGesture(DragGesture(minimumDistance: 0), including: .all)

For the sake of transparency, I did not come up with this, but instead found it here (https://swiftuirecipes.com/blog/swiftui-disable-scroll-in-scrollview-or-list) and figured it would be helpful to repost to this thread as well!