---
title: "level(forItem:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsoutlineview/level(foritem:)"
---

# level(forItem:)

Returns the indentation level for a given item.

## Declaration

```swift
func level(forItem item: Any?) -> Int
```

## Parameters

- `item`: An item in the receiver.

## Return Value

Return Value The indentation level for item. If item is nil (which is the root item), returns –1.

## Discussion

Discussion The levels are zero-based—that is, the first level of displayed items is level 0.

## See Also

### Working with Indentation

- [level(forRow:)](appkit/nsoutlineview/level(forrow:).md)
- [indentationPerLevel](appkit/nsoutlineview/indentationperlevel.md)
- [indentationMarkerFollowsCell](appkit/nsoutlineview/indentationmarkerfollowscell.md)
