init(target:action:)
Creates a gesture recognizer with a target and an action selector.
Declaration
init(target: Any?, action: Selector?)Parameters
- target:
An object that is the recipient of action messages sent by the receiver when it recognizes a gesture.
nilisn’t a valid value. - action:
A selector that identifies the method implemented by the target to handle the gesture recognized by the receiver. The action selector must conform to the signature described in the class overview.
nilisn’t a valid value.
Return Value
An initialized instance of a concrete UIGestureRecognizer subclass.
Discussion
This method is the designated initializer. After creating the gesture recognizer, you may associate other target-action pairs with it by calling addTarget(_:action:).