I try to create UIButton, which will increase some variable with long-pressing. So, when user touch button for long time increasing handler repeats.
I have something like this:
Swift 4.0
@IBOutlet var increaseButton: UIButton!
var someVariable = 0
...
increaseButton.addTarget(self, action: #selector(increase(sender:)), for: .touchUpInside)
...
@IBAction func increase(sender: UIButton) {
someVariable += 1
}
Thanks for all answers!