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

# indexOfSelectedItem

The index of the item last selected by the user.

```
var indexOfSelectedItem: Int { get }
```

## Discussion

The value of this property is the index of the selected item, or `-1` if no item is selected.

## See Also

[`indexOfItem(withTag:)`](/documentation/AppKit/NSPopUpButtonCell/indexOfItem(withTag:))

Returns the index of the menu item with the specified tag.

[`indexOfItem(withTitle:)`](/documentation/AppKit/NSPopUpButtonCell/indexOfItem(withTitle:))

Returns the index of the item with the specified title.

[`index(of:)`](/documentation/AppKit/NSPopUpButtonCell/index(of:))

Returns the index of the specified menu item.

[`indexOfItem(withTarget:andAction:)`](/documentation/AppKit/NSPopUpButtonCell/indexOfItem(withTarget:andAction:))

Returns the index of the menu item with the specified target and action.

[`indexOfItem(withRepresentedObject:)`](/documentation/AppKit/NSPopUpButtonCell/indexOfItem(withRepresentedObject:))

Returns the index of the menu item that holds the specified represented object.



---

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)