---
title: "menu(forSegment:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssegmentedcontrol/menu(forsegment:)"
---

# menu(forSegment:)

Returns the menu for the specified segment.

## Declaration

```swift
func menu(forSegment segment: Int) -> NSMenu?
```

## Parameters

- `segment`: The index of the segment whose menu you want to get. This method raises an exception (doc://com.apple.documentation/documentation/Foundation/NSExceptionName/rangeException) if the index is out of bounds.

## Return Value

Return Value The menu associated with the segment; otherwise, nil.

## See Also

### Configuring a segment menu

- [setMenu(_:forSegment:)](appkit/nssegmentedcontrol/setmenu(_:forsegment:).md)
- [setShowsMenuIndicator(_:forSegment:)](appkit/nssegmentedcontrol/setshowsmenuindicator(_:forsegment:).md)
- [showsMenuIndicator(forSegment:)](appkit/nssegmentedcontrol/showsmenuindicator(forsegment:).md)
- [isSpringLoaded](appkit/nssegmentedcontrol/isspringloaded.md)
