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

# selectedRow

The index of the last selected row (or the last row added to the selection).

```
var selectedRow: Int { get }
```

## Discussion

When multiple rows are selected, this property contains only the index of the last one in the selection. If no row is selected, the value of this property is `-1`.

## See Also

[`-  selectRow:byExtendingSelection:`](/documentation/AppKit/NSTableView/selectRow:byExtendingSelection:)

Selects a row at the specified index, optionally extending any existing selection.

[`-  selectedRowEnumerator`](/documentation/AppKit/NSTableView/selectedRowEnumerator)

This method has been deprecated.



---

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)