---
title: "parentRow(forRow:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsruleeditor/parentrow(forrow:)"
---

# parentRow(forRow:)

Returns the index of the parent of a given row.

## Declaration

```swift
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

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

## See Also

### Obtaining Row Information

- [numberOfRows](appkit/nsruleeditor/numberofrows.md)
- [row(forDisplayValue:)](appkit/nsruleeditor/row(fordisplayvalue:).md)
- [rowType(forRow:)](appkit/nsruleeditor/rowtype(forrow:).md)
- [NSRuleEditor.RowType](appkit/nsruleeditor/rowtype.md)
- [subrowIndexes(forRow:)](appkit/nsruleeditor/subrowindexes(forrow:).md)
