100 Days of SwiftUI

Day 86

2026-08-08

Project 17, part 1

Flashzilla: a project for learning about gestures

How to use gestures in SwiftUI

  • More than onTapGesture()
  • onLongPressGesture() can be adjusted to trigger after a certain amount of seconds
  • onPressingChanged: keeps track of the progress of the trigger
  • watch out for clashing gestures — child gestures have priority unless you specify otherwise
  • you can also have gesture sequences, e.g. let combined = pressGesture.sequenced(before: dragGesture)
samoyed sketchsamoyed sketch

Disabling user interactivity with allowsHitTesting()

  • if a View has .allowsHitTesting(false) it gets ignored on tap
  • you can do a lot of confusing things!