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

# ruleEditor(_:child:forCriterion:with:)

Returns the child of a given item at a given index.

## Declaration

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

## Parameters

- `editor`: The rule editor that sent the message.
- `index`: The index of the requested child criterion. This value must be in the range from 0 up to (but not including) the number of children, as reported by the delegate in doc://com.apple.appkit/documentation/AppKit/NSRuleEditorDelegate/ruleEditor(_:numberOfChildrenForCriterion:with:).
- `criterion`: The parent of the requested child, or nil if the rule editor is requesting a root criterion.
- `rowType`: The type of the row.

## Return Value

Return Value An object representing the requested child (or root) criterion. This object is used by the delegate to represent that position in the tree, and is passed as a parameter in subsequent calls to the delegate.

## Discussion

Discussion The delegate must implement this method.

## See Also

### Related Documentation

- [Predicate Programming Guide](apple-archive/documentation/Cocoa/Conceptual/Predicates/AdditionalChapters/Introduction.html.md)
- [NSRuleEditor](appkit/nsruleeditor.md)

### Providing Data

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