Search code examples
swift3uitapgesturerecognizer

Swift 3 TapGestureRecognizer selector throwing error


I've looked at a couple of other post with issues of adding a target to not just tap gestures and buttons and I think I am following the formatting correctly but am still getting the 'has no member' error, here's my pseudo code:

let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.handlTap(_:)))

func handleTap(_ sender: AnyObject) {
    }

Solution

  • add the gesture to your view:

    view.addGestureRecognizer(yourGesture)