Analysis updated 2026-05-18
Build a calendar app in SwiftUI where events snap to 15-minute slots during drag.
Fix the second-drag jump bug in a SwiftUI draggable view by separating committed position from live offset.
Prevent a ScrollView from competing with a drag gesture in an iOS app.
Copy a minimal template for a parent-owns-state drag architecture in SwiftUI.
| aydahnizzy/calendar-drag-interaction | dizzpy/boo | heyitsbarish/nomad-classic | |
|---|---|---|---|
| Stars | 4 | 4 | 4 |
| Language | Swift | Swift | Swift |
| Setup difficulty | easy | easy | moderate |
| Complexity | 2/5 | 2/5 | 3/5 |
| Audience | developer | general | ops devops |
Figures from each repo's GitHub metadata at analysis time.
Requires Xcode with iOS 18 SDK, some patterns may not behave correctly on earlier iOS versions.
This repository is a SwiftUI calendar demo for iOS 18 that shows how to build smooth, reliable drag-and-drop for calendar event blocks. The core of the project is a practical guide to the six common mistakes that cause drag interactions to feel broken in SwiftUI, written by the author while debugging a real calendar feature inside a scroll view. The problems the README addresses are specific to SwiftUI's gesture system: events that teleport to your finger on first touch, events that jump when you pick them up a second time, scroll views that fight with drag gestures, and animations that spring awkwardly instead of following your finger. Each rule in the guide explains one of these failure modes and shows the correct code pattern alongside the broken version. The six rules are: always use the translation value (the distance moved) rather than the location value (the absolute finger position), anchor the coordinate space to the device screen rather than the scroll view, disable scroll movement while dragging, keep the committed position and the live drag offset as two separate state values, commit state changes synchronously at the end of a drag rather than inside an animation callback, and avoid attaching automatic animations directly to drag-driven views. The demo calendar itself shows events snapping to 15-minute time slots, side-by-side overlap display when two events occupy the same time during a drag, and haptic feedback at each time boundary. A minimal code template at the end of the README brings all six rules together into one copy-pasteable SwiftUI component structure, where a child view handles gestures and a parent view owns all drag state. This separation avoids the second-drag jump bug that results from mixing committed and in-flight position in the same variable. The README does not specify a license. The intended audience is iOS developers already comfortable with SwiftUI who want a correct reference implementation for calendar-style drag interactions.
A SwiftUI iOS 18 calendar demo that teaches six rules for correct drag-and-drop inside a ScrollView, with working code patterns for each common failure mode.
Mainly Swift. The stack also includes Swift, SwiftUI, iOS 18.
Setup difficulty is rated easy, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.