---
title: "target(forAction:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsapplication/target(foraction:)"
---

# target(forAction:)

Returns the object that receives the action message specified by the given selector.

## Declaration

```swift
func target(forAction action: Selector) -> Any?
```

## Parameters

- `action`: The desired action message.

## Return Value

Return Value The object that would receive the specified action message or nil if no target object would receive the message. This method also returns nil if aSelector is nil.

## See Also

### Posting actions

- [tryToPerform(_:with:)](appkit/nsapplication/trytoperform(_:with:).md)
- [sendAction(_:to:from:)](appkit/nsapplication/sendaction(_:to:from:).md)
- [target(forAction:to:from:)](appkit/nsapplication/target(foraction:to:from:).md)
