<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSRuleEditorDelegate/ruleEditor(_:child:forCriterion:with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSRuleEditorDelegate(im)ruleEditor:child:forCriterion:withRowType:"
  },
  "title" : "ruleEditor(_:child:forCriterion:with:)"
}
-->

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

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

```
@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 [`ruleEditor(_:numberOfChildrenForCriterion:with:)`](/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

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

The delegate must implement this method.

## See Also

[`class NSRuleEditor`](/documentation/AppKit/NSRuleEditor)

An interface for configuring a rule-based list of options.



---

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)