<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSControl/sendAction(_:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSControl(im)sendAction:to:"
  },
  "title" : "sendAction(_:to:)"
}
-->

# sendAction(_:to:)

Causes the specified action to be sent to the target.

```
func sendAction(_ action: Selector?, to target: Any?) -> Bool
```

## Parameters

`action`

The selector to invoke on the target. If the selector is `NULL`, no message is sent.

`target`

The target object to receive the message. If the object is `nil`, the application searches the responder chain for an object capable of handling the message. For more information on dispatching actions, see the class description for [`NSActionCell`](/documentation/AppKit/NSActionCell).

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the message was successfully sent; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

This method uses the [`sendAction(_:to:from:)`](/documentation/AppKit/NSApplication/sendAction(_:to:from:)) method of `NSApplication` to invoke the specified method on an object. The receiver is passed as the parameter to the action message. This method is invoked primarily by the  [`trackMouse(with:in:of:untilMouseUp:)`](/documentation/AppKit/NSCell/trackMouse(with:in:of:untilMouseUp:)) method of `NSCell`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)