@Ramshad accepted the answer in Swift 3.0 syntax using the following method of the UIControl class
open func addTarget(_ target: Any?, action: Selector, for controlEvents: UIControlEvents)
Example:
myButton.addTarget(self, action:
myButton.addTarget(self, action:
func touchDownEvent(_ sender: AnyObject) {
print("TouchDown")
}
func touchUpEvent(_ sender: AnyObject) {
print("TouchUp")
}
source
share