r/iOSDevelopment • • 4h ago

Drag-and-resize on a timeline grid: two SwiftUI things that cost me a week

I built a day planner where every task carries a start time and a length, so the day is a 2D layout and overlaps are visible before they happen. Two things took far longer than expected.

  1. A DragGesture inside a LazyVStack loses to the scroll view almost every time. What finally worked was one high-priority gesture on the container that hit-tests which block is under the finger, instead of a gesture attached to each row.
  2. Collision detection belongs in the model, not the view. I spent days computing overlaps during layout, which made dragging stutter. Moving it into the store made the drag instant and let the same code show a conflict before you drop.

It is live and free of review gatekeeping, so you can poke at the interaction directly: https://apps.apple.com/app/id6804453041

1 Upvotes

0 comments sorted by