---
title: "removeTarget(_:action:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uigesturerecognizer/removetarget(_:action:)"
---

# removeTarget(_:action:)

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

## Declaration

```swift
func removeTarget(_ target: Any?, action: Selector?)
```

## Parameters

- `target`: An object that currently is a recipient of action messages sent by the receiver when the represented gesture occurs. Specify nil if you want to remove all targets from the receiver.
- `action`: A selector identifying a method of a target to be invoked by the action message. Specify NULL if you want to remove all actions from the receiver.

## Discussion

Discussion Calling this method removes the specified target-action pair. Passing nil for target matches all targets and passing NULL for action matches all actions.

## See Also

### Related Documentation

- [init(target:action:)](uikit/uigesturerecognizer/init(target:action:).md)

### Adding and removing targets and actions

- [addTarget(_:action:)](uikit/uigesturerecognizer/addtarget(_:action:).md)
