youssef mostafa youssef mostafa - 26 days ago 4x
iOS Question

What is target in gesture recognizer?

UITapGestureRecognizer(target: , action: )
hi guys i'm new to IOS development, so could any body tells me the use of target here
thanks in advance.


Target - means the object, where UIGestureRecognizer will look to find the action.

From documentation: target - an object that is the recipient of action messages sent by the receiver when it recognizes a gesture. nil is not a valid value.

So, for example if you adding UIGestureRecongnizer for the view of view controller you have to add self as a target.