---
title: "menu(for:string:options:atLocation:in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsspellchecker/menu(for:string:options:atlocation:in:)"
---

# menu(for:string:options:atLocation:in:)

Provides a menu containing contextual menu items suitable for certain kinds of detected results.

## Declaration

```swift
func menu(for result: NSTextCheckingResult, string checkedString: String, options: [NSSpellChecker.OptionKey : Any]? = nil, atLocation location: NSPoint, in view: NSView) -> NSMenu?
```

## Parameters

- `result`: The doc://com.apple.documentation/documentation/Foundation/NSTextCheckingResult instance for the checked string.
- `checkedString`: The string that has been checked.
- `options`: The options dictionary allows clients to pass in information associated with the document. See Spell Checking Option Dictionary Keys for possible key-value pairs.
- `location`: The location, in the view’s coordinate system, to display the menu.
- `view`: The view object over which to display the contextual menu.

## Return Value

Return Value A menu suitable for displaying as a contextual menu, or adding to another contextual menu as a submenu.

## See Also

### Data Detector Interaction

- [NSSpellChecker.OptionKey](appkit/nsspellchecker/optionkey.md)
