๐Ÿ”ฐupdate gesture states

SwiftUI โŸฉ Gestures โŸฉ update gesture states

Gesture state is "transient" which means it will reset back to its initial state when user ends or cancels the gesture.

  • To update a view as a gesture changes, add a GestureState property to your view and update it with updating(_:body:).

  • SwiftUI invokes the updating callback as soon as it recognizes the gesture and whenever the value of the gesture changes.

  • SwiftUI doesnโ€™t invoke the updating callback when the user ends or cancels a gesture. Instead, the gesture state property automatically resets its state back to its initial value.

Last updated