---
title: "forEachFrame(_:)"
framework: metrickit
role: symbol
role_heading: Instance Method
path: "metrickit/callstacktree/foreachframe(_:)"
---

# forEachFrame(_:)

Iterates all frames efficiently.

## Declaration

```swift
func forEachFrame(_ body: (CallStackFrame) throws -> Void) rethrows
```

## Parameters

- `body`: A closure that processes each frame

## Mentioned in

Analyzing app performance with MetricKit

## Discussion

Discussion Use this method for optimized traversal of the entire call stack tree.

## See Also

### Threads and frames

- [callStackThreads](metrickit/callstacktree/callstackthreads.md)
- [callStackPerThread](metrickit/callstacktree/callstackperthread.md)
