Tutorials › Launch Lab Notes › Chapter 17

Who Won the Drag

LabChapter 17 of the Launch Lab Notes20 minAugust 19, 2026Intermediate

Same finger. Same vertical drag. Two Harbor cards inside one ScrollView.

Which one moves?

Filmstrip: IDLE, LONGPRESS arms PRIORITY, DRAG+72 with WINNER PRIORITY, then PLAIN LOST with SCROLL WON.

Idle — both at zero

PHASE IDLE: PRIORITY 0 pt idle, PLAIN 0 pt idle. EVENT TAPE IDLE. Both Harbor cards at rest above shipment fillers.
CardOffsetState
PRIORITY0 ptidle
PLAIN0 ptidle

PRIORITY will use .highPriorityGesture with a sequenced long-press → drag. PLAIN is the control: the same DragGesture via plain .gesture.

Armed — long-press first

LongPressGesture(minimumDuration: 0.35)
  .sequenced(before: DragGesture(minimumDistance: 4))
PHASE ARMED: PRIORITY 0 pt armed, PLAIN idle. EVENT TAPE LONGPRESS. PRIORITY card says long-press held.

Observed: PHASE ARMED, tape LONGPRESS, PRIORITY detail armed, offset still 0 pt. Sequencing matters — the drag has not started yet.

Priority wins — 72 pt

PHASE PRIORITY: PRIORITY 72 pt armed, PLAIN 0 pt. WINNER PRIORITY. EVENT TAPE LONGPRESS · DRAG+72. Footer P 72 · L 0.
CardOffsetWinner
PRIORITY72 ptPRIORITY
PLAIN0 pt—

Tape: LONGPRESS · DRAG+72. Footer: P 72 · L 0.

.highPriorityGesture tells the scroll view to yield. The card moves; the list does not.

Plain loses — scroll won

PHASE PLAIN LOST: PRIORITY 0 pt idle, PLAIN 0 pt scroll won. WINNER SCROLL. EVENT TAPE SCROLL WON.
CardOffsetDetail
PRIORITY0 ptidle
PLAIN0 ptscroll won

PHASE PLAIN LOST. WINNER SCROLL. Tape: SCROLL WON.

The control never moved. Vertical intent went to the ScrollView because .gesture(DragGesture()) does not outrank scroll.

Same DragGesture, different modifier

The cards share the idea of a vertical drag. Only the attachment changes: highPriorityGesture vs gesture. If your handle refuses to move inside a list, check which modifier you used before rewriting the gesture itself.

Sequenced, not simultaneous

Long-press before drag is .sequenced(before:). Simultaneous would try to recognize both at once (pulse while dragging). This bench arms first, then drags — the tape shows LONGPRESS alone before DRAG+72.

Mini-exercise

Swap PRIORITY to plain .gesture and PLAIN to .highPriorityGesture. Re-run. The rose card should be the one that can show a non-zero offset.

Challenges

  1. Add a third card with .simultaneousGesture(DragGesture()) and photograph whether scroll and drag both fire.
  2. Replace sequencing with simultaneous long-press + drag and show the scale pulse during the drag still.
  3. Use .highPriorityGesture on PLAIN but only for horizontal drags (DragGesture that ignores dy) — vertical should still scroll.
  4. Drive a real finger on device and confirm the scripted 72 pt / SCROLL WON labels match what you feel.
  5. XCUITest: after -mode priority, assert static text contains 72 and WINNER PRIORITY.

Key Points

Next up: environment and preferences — values travelling down (Environment) and measurements travelling up (PreferenceKey) on one screen, both directions traced.

SwiftUI
SwiftUI tutorials for building native app screens, layouts, navigation, and state-driven interfaces.
Swift
Swift fundamentals for app developers who want to understand the language behind real iOS and macOS apps.
Ship iOS
Shipping workflows for iOS apps.
📚 Go deeper with LIPAI WANG’s hands-on Udemy bootcampsBrowse all courses →
← Ch 16: Three Levels, One PathCh 18: Down the Tree, Up the Tree→
SwiftUIUltimate SwiftUI SeriesSwiftUI tutorials for building native app screens, layouts, navigation, and state-driven interfaces.SwiftUltimate Swift SeriesSwift fundamentals for app developers who want to understand the language behind real iOS and macOS apps.Ship iOSShip iOS Apps SeriesShipping workflows for iOS apps: signing, TestFlight, App Store Connect, CI, and release hygiene.

Ship your apps faster

When you're ready to publish your Swift app to the App Store, Simple App Shipper handles metadata, screenshots, TestFlight, and submissions — all in one place.

Try Simple App Shipper
5 free articles remainingSubscribe for unlimited access