Instance Method


Adds a target and an action to a gesture-recognizer object.


func addTarget(_ target: Any, action: Selector)



An object that is a recipient of action messages sent by the receiver when the represented gesture occurs. nil is not a valid value.


A selector identifying a method of a target to be invoked by the action message. NULL is not a valid value.


You may call this method multiple times to specify multiple target-action pairs. However, if you request to add a target-action pair that has already been added, then the request is ignored.

See Also

Adding and Removing Targets and Actions

func removeTarget(Any?, action: Selector?)

Removes a target and an action from a gesture-recognizer object.