---
title: "enumerateObjects(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsarray/enumerateobjects(_:)"
---

# enumerateObjects(_:)

Executes a given closure or block using each object in the array, starting with the first object and continuing through the array to the last object.

## Declaration

```swift
func enumerateObjects(_ block: (Any, Int, UnsafeMutablePointer<ObjCBool>) -> Void)
```

## Parameters

- `block`: A closure or block to execute for each object in the array, taking three arguments: The object. The index of the object in the array. A reference to a Boolean value, which the closure can set to doc://com.apple.documentation/documentation/Swift/true in order to stop further enumeration of the array. If a closure stops further enumeration, that closure continues to run until it’s finished.

## Discussion

Discussion This method executes synchronously. Values allocated within the block are deallocated after the block is executed.

## See Also

### Sending Messages to Elements

- [enumerateObjects(options:using:)](foundation/nsarray/enumerateobjects(options:using:).md)
- [enumerateObjects(at:options:using:)](foundation/nsarray/enumerateobjects(at:options:using:).md)
