---
title: "removeTarget(_:action:for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscontrol/removetarget(_:action:for:)"
---

# removeTarget(_:action:for:)

Stops the delivery of events to the specified target object.

## Declaration

```swift
func removeTarget(_ target: Any?, action: Selector?, for controlEvents: NSControl.Events)
```

## Parameters

- `target`: A target object registered with the control. Specify nil to remove the specified control events for all target objects.
- `action`: A selector identifying a registered action method. You may specify nil for this parameter.
- `controlEvents`: A bit mask specifying the control events to remove for the specified target object. For a list of possible constants, see doc://com.apple.appkit/documentation/AppKit/NSControl/Events.

## Discussion

Discussion Use this method to prevent the delivery of control events to a target object. If you specify a valid object in the target parameter, this method stops the delivery of the specified events to all action methods associated with that object. If you specify nil for the target parameter, this method prevents the delivery of those events to all action methods of all target objects.

## See Also

### Handling Control Events

- [NSControl.Events](appkit/nscontrol/events.md)
- [addTarget(_:action:for:)](appkit/nscontrol/addtarget(_:action:for:).md)
