I couldn’t get the provided code sample to work without a compiler error when instantiating the doubleTapRecognizer. The use of “#selector” for the action parameter caused an error with Xcode 9.2:
“Argument of ‘#selector’ refers to instance method ‘tap’ that is not exposed to Objective-C”
I won’t duplicate the code, because it matches the printed one.
The “fix” was to expose the method doubleTap(_ to objective-C.
I’m not certain what this means, but it required adding “@objc” to the function declaration:
@objc func doubleTap(_ gestureRecognizer: UIGestureRecognizer) {
print ("Recognized a double tap")
currentLines.removeAll()
finishedLines.removeAll()
setNeedsDisplay()
}