I want to add a gesture to my opinion as follows:
override func viewDidLoad() { super.viewDidLoad() < blah blah blah > // Add tap gesture let tap = UITapGestureRecognizer(target: self, action:
However, in Swift 4, my compiler tells me the following error:
Argument of '#selector' refers to instance method 'handleTap()' that is not exposed to Objective-C
It is suggested to add @objc to show this method of the Objective-C instance.
Another implementation option (with code only) would be to override the touchesBegan() function and use it to handle the tap.
I try to do this "Swift" without resorting to Obj-C. Is there a clean Swift way to add this tap gestures without using @objc? Or is this the usual and supposed way to add this tap gestures?
ios objective-c xcode swift swift4
Arty52 Jul 02 '17 at 2:46 on 2017-07-02 02:46
source share