---
title: "countKeyPath(for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstreecontroller/countkeypath(for:)"
---

# countKeyPath(for:)

Returns the key path that provides the number of children for a specified node.

## Declaration

```swift
func countKeyPath(for node: NSTreeNode) -> String?
```

## Parameters

- `node`: A tree node in the tree controller’s content.

## Return Value

Return Value A string containing the key path in node that provides the number of children.

## See Also

### Specifying model attributes

- [childrenKeyPath](appkit/nstreecontroller/childrenkeypath.md)
- [childrenKeyPath(for:)](appkit/nstreecontroller/childrenkeypath(for:).md)
- [countKeyPath](appkit/nstreecontroller/countkeypath.md)
- [leafKeyPath](appkit/nstreecontroller/leafkeypath.md)
- [leafKeyPath(for:)](appkit/nstreecontroller/leafkeypath(for:).md)
