Init for UITapGestureRecognizer

In case anyone else encounters this, page 292 states:

     let doubleTapRecognizer = UITapGestureRecognizer(target: self, action: "doubleTap:")

xCode says that method has been depreciated for calling the function “doubleTap:”.

This works:

        let doubleTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(DrawView.doubleTap(_:)))

Not sure what you are seeing. What version of Xcode are you using? This works fine with no warning for me.

I’m using Version 7.3.

The same for me. You can still use it but it’s deprecated, that is will be removed in next swift release 3.0

Anyway I’ve already adopted the new ‘#selector()’ mode

let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(DrawView.tap))

diskprotek, thanks for your input.

I am using Xcode Version 8.2.1, swift 3, and this is the only way this works for me,