<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSMenuItem/target",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMenuItem(py)target"
  },
  "title" : "target"
}
-->

# target

The menu item’s target.

```
weak var target: AnyObject? { get set }
```

## Discussion

To ensure that a menu item’s target can receive commands while a modal dialog is open, the target object should return <doc://com.apple.documentation/documentation/Swift/true> in [`worksWhenModal`](/documentation/AppKit/NSPanel/worksWhenModal).

---

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)