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

# level(forItem:)

Returns the indentation level for a given item.

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

## Parameters

`item`

An item in the receiver.

## Return Value

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

## Discussion

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

---

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)