I have the following SwiftUI view:
struct ContentView: View {
@State var model: Model
var body: some View {
ScrollView {
LazyVGrid(columns: columns, spacing: 10) {
ForEach(model.events, id: \.self) { event in
CardView(event: event)
}
.onMove { indices, newOffset in
model.events.move(fromOffsets: indices, toOffset: newOffset)
}
}
}
}
}
However, it doesn't appear that the onMove
closure is executing. I believe this is because all gestures are only given to the ScrollView
and so the inner views don't receive the gestures.
I tried converting this view to a List
, however I don't want the row separators, which in iOS 14 I believe are impossible to hide.
So, I was wondering what I need to change to get this to allow the user to drag and drop CardView
s to reorder them. Thanks!