---
title: "enumerateChildObjects(of:root:using:stopPointer:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdlobject/enumeratechildobjects(of:root:using:stoppointer:)"
---

# enumerateChildObjects(of:root:using:stopPointer:)

Executes the specified block using each object in this object’s child hierarchy.

## Declaration

```swift
func enumerateChildObjects(of objectClass: AnyClass, root: MDLObject, using block: @escaping (MDLObject, UnsafeMutablePointer<ObjCBool>) -> Void, stopPointer: UnsafeMutablePointer<ObjCBool>)
```

## Parameters

- `objectClass`: A Model I/O class representing a type of child objects to evaluate. For example, pass the doc://com.apple.modelio/documentation/ModelIO/MDLMesh class to evaluate all 3D objects stored in the asset. Pass the doc://com.apple.modelio/documentation/ModelIO/MDLObject class to evaluate all child objects regardless of type.
- `root`: The root object at which to begin traversing the child object hierarchy.
- `block`: The block to apply to child objects. This block takes two parameters: the object to be evaluated by the block, and a stop pointer that you can set to doc://com.apple.documentation/documentation/Swift/true to stop further evaluation of the object hierarchy.
- `stopPointer`: Set this pointer’s value to doc://com.apple.documentation/documentation/Swift/true during enumeration to stop further enumeration of the object hierarchy.

## See Also

### Working with Object Hierarchies

- [parent](modelio/mdlobject/parent.md)
- [children](modelio/mdlobject/children.md)
- [addChild(_:)](modelio/mdlobject/addchild(_:).md)
- [path](modelio/mdlobject/path.md)
- [atPath(_:)](modelio/mdlobject/atpath(_:).md)
