---
title: "ruleEditor(_:numberOfChildrenForCriterion:with:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsruleeditordelegate/ruleeditor(_:numberofchildrenforcriterion:with:)"
---

# ruleEditor(_:numberOfChildrenForCriterion:with:)

Returns the number of child items of a given criterion or row type.

## Declaration

```swift
@MainActor func ruleEditor(_ editor: NSRuleEditor, numberOfChildrenForCriterion criterion: Any?, with rowType: NSRuleEditor.RowType) -> Int
```

## Parameters

- `editor`: The rule editor that sent the message.
- `criterion`: The criterion for which the number of children is required.
- `rowType`: The type of row of criterion.

## Return Value

Return Value The number of child items of criterion. If criterion is nil, return the number of root criteria for the row type rowType.

## Discussion

Discussion The delegate must implement this method.

## See Also

### Providing Data

- [ruleEditor(_:child:forCriterion:with:)](appkit/nsruleeditordelegate/ruleeditor(_:child:forcriterion:with:).md)
- [ruleEditor(_:displayValueForCriterion:inRow:)](appkit/nsruleeditordelegate/ruleeditor(_:displayvalueforcriterion:inrow:).md)
- [ruleEditor(_:predicatePartsForCriterion:withDisplayValue:inRow:)](appkit/nsruleeditordelegate/ruleeditor(_:predicatepartsforcriterion:withdisplayvalue:inrow:).md)
- [NSRuleEditor.PredicatePartKey](appkit/nsruleeditor/predicatepartkey.md)
