I have made a bit of code that when the user taps everywhere on the screen the points/score/taps will increment by 1. But the problem is then it counts how many continuous taps I make and then if I leave a 1 second gap between pressing it will restart the counter. Is there any way I could make it stop restarting?
CODE:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var tapsLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
let touch = touches.first as! UITouch
let tapCount = touch.tapCount
tapsLabel.text = "Taps: \(tapCount)"
}
}