Question : swift uiview add tap gesture
Answered by : mobile-star
let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTap(_:)))
myView.addGestureRecognizer(tap)
// Then, you should implement the handler, which will be called each time when a tap event occurs:
@objc func handleTap(_ sender: UITapGestureRecognizer? = nil) { // handling code
}
Source : | Last Update : Wed, 01 Apr 20
Question : swiftui tap gesture
Answered by : tony-sacco
Text("Hello, World!") .onTapGesture(count: 2) { print("Double tapped!") }
Source : https://www.hackingwithswift.com/books/ios-swiftui/how-to-use-gestures-in-swiftui | Last Update : Sun, 17 Jul 22