<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSRuleEditor/parentRow(forRow:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSRuleEditor(im)parentRowForRow:"
  },
  "title" : "parentRow(forRow:)"
}
-->

# parentRow(forRow:)

Returns the index of the parent of a given row.

```
func parentRow(forRow rowIndex: Int) -> Int
```

## Parameters

`rowIndex`

The index of a row in the receiver.
  
  > Important:
  > Raises an `NSRangeException` if `rowIndex` is less than `0` or greater than or equal to the number of rows.

## Return Value

The index of the parent of the row at `rowIndex`. If the row at `rowIndex` is a root row, returns `-1`.

---

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)