The click recognizer is done, but I can't figure out how to change that click recognizer to double-click.
Code:
import Foundation import UIKit class MainBoardController: UIViewController{ let tap = UITapGestureRecognizer() override func viewDidLoad() { () // Do any additional setup after loading the view,typically from a nib. var swipe: UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self,action: "GotoProfile") = (swipe) (self,action: "GotoCamera") = true (tap) } override func didReceiveMemoryWarning() { () // Dispose of any resources that can be recreated. } func GotoProfile(){ ("Profilesegue",sender: nil) } func GotoCamera(){ ("Camerasegue",sender: nil) } }
Solution
Finally, the extension solved this problem:
override func viewDidLoad() { () let tapGR = UITapGestureRecognizer(target: self,action: #selector((_:))) = self = 2 (tapGR) } extension MainBoardController: UIGestureRecognizerDelegate { func handleTap(_ gesture: UITapGestureRecognizer){ print("doubletapped") } }
Summarize
The above is all the content of how to add a double-click gesture recognizer in Swift that I have collected and organized for you. I hope the article can help you solve the program development problems encountered in how to add a double-click gesture recognizer in Swift.