I am new in swift and I am doing a tic tac toe, with some improvements in the gaming, so I need to put some condicionals, but my real problem is when I am playing I need to do double click to change a button with no image to a button with image and this is anoying to the player.
I put somes Outlet because I need to desable some buttons (this depend of the players) but I think this no has relation with my mistake because one day I errased all my Outlets to found my mistake and I still needed to do double click, thanks for helping and have a nice day.
You can specify the number of taps required for a UITapGestureRecognizer. Instead of the view, you could set to the button/image.
override func viewDidLoad() {
super.viewDidLoad()
let tap = UITapGestureRecognizer(target: self, action: #selector(doubleTapped))
tap.numberOfTapsRequired = 2
view.addGestureRecognizer(tap)
}
@objc func doubleTapped() {
// do something here
}