0

I am making drag & drop lazyVGrid.

i did reference this answer

SwiftUI | Using onDrag and onDrop to reorder Items within one single LazyGrid?

when drag move another item position it working well

but when I long press and not move and drop itself self.dragging not set to nil

how can I fix it??

1 Answers1

0

I would try to do like this.

.gesture(DragGesture()
    .onChanged({ value in
                    if value.x == 0 && value.y == 0 {
                        self.dragging = nil
                    }
                    })
)
Taeeun Kim
  • 964
  • 1
  • 8
  • 20