Tap gesture
Mar 15, 2024
The .onTapGesture modifier functions much like a button and can even be customized to recognize multiple taps instead of just one (double-tap, triple-tap, etc.).
Create a button to change the colour of rectangle.
onTap Gesture works differently than the button.
- We can put onTap gesture on any texts, shapes, images and anything.
- Button shows the highlighted state, but tap gesture doesn’t
onTapGesture with Count and perform completion
count: number of taps to perform the action
just like instagram.