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

# setTitleWithMnemonic(_:)

Sets the title of a menu item with a character denoting an access key.

```
func setTitleWithMnemonic(_ stringWithAmpersand: String)
```

## Discussion

Use an ampersand character to mark the character (the one following the ampersand) to be designated.

## See Also

[`-  mnemonic`](/documentation/AppKit/NSMenuItem/mnemonic)

Returns the character in the menu item title that appears underlined for use as a mnemonic.

[`-  setMnemonicLocation:`](/documentation/AppKit/NSMenuItem/setMnemonicLocation:)

Sets the character of the menu item title at location that is to be underlined.



---

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)