37. Working with Gesture Recognizers in SwiftUI
The term gesture is used to describe an interaction between the touch screen and the user which can be detected and used to trigger an event in the app. Drags, taps, double taps, pinching, rotation motions and long presses are all considered to be gestures in SwiftUI.
The goal of this chapter is to explore the use of SwiftUI gesture recognizers within a SwiftUI based app.
37.1 Creating the GestureDemo Example Project
To try out the examples in this chapter, create a new Multiplatform App Xcode project named GestureDemo.
37.2 Basic Gestures
Gestures performed within the bounds of a view can be detected by adding a gesture recognizer to that view. SwiftUI provides recognizers for tap, long press, ...
Get SwiftUI Essentials – iOS 14 Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.