TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

DragGestures of subviews override List's scrolling

Forums > SwiftUI

Say I have this list right here:

List {
  ForEach(0..<10) { i in
    RowView()
  }
}

Where every RowView has a .gesture(DragGesture()) modifier on its main view. The problem is that now the list won't scroll at all! Fortunately for me, I only need this drag gesture to work horizontally and not vertically. Is there a way to fix the list?

I could replace the list with ScrollView { LazyVStack { ... } } but that makes the scrolling sometimes trigger the dragging without ending it.

2      

Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.