Chapter 17
Understanding Gestures
In earlier chapters, you got a taste of building gestures with SwiftUI. We used the onTapGesture modifier to handle a user's touch and provide a corresponding response. In this chapter, let's dive deeper and explore how to work with various types of gestures in SwiftUI.
The SwiftUI framework provides several built-in gestures, such as the tap gesture we have used before. Additionally, there are gestures like DragGesture, MagnificationGesture, and LongPressGesture that are ready to use. We will explore a couple of these gestures and see how to work with them in SwiftUI. Moreover, you will learn how to build a generic view that supports the drag gesture.

Using the Gesture Modifier
To recognize a particular gesture using SwiftUI, you can attach a gesture recognizer to a view using the .gesture modifier. Here is a sample code snippet that attaches a TapGesture using the .gesture modifier:
To access the full content and the complete source code, please get your copy at https://www.appcoda.com/swiftui.