---
title: "numberOfChildren(ofItem:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsoutlineview/numberofchildren(ofitem:)"
---

# numberOfChildren(ofItem:)

Returns the number of children for the specified parent item.

## Declaration

```swift
func numberOfChildren(ofItem item: Any?) -> Int
```

## Parameters

- `item`: The parent item.

## Return Value

Return Value The number of children associated with the parent.

## Discussion

Discussion You can call this method on an outline view with either a static or dynamic data source. For an outline view whose contents are dynamic, this method may call out to the outlineView(_:numberOfChildrenOfItem:) method of the associated data source object.

## See Also

### Getting Related Items

- [parent(forItem:)](appkit/nsoutlineview/parent(foritem:).md)
- [childIndex(forItem:)](appkit/nsoutlineview/childindex(foritem:).md)
- [child(_:ofItem:)](appkit/nsoutlineview/child(_:ofitem:).md)
