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

# enumerateObjects(options:using:)

Executes a given closure or block using each object in the array with the specified options.

## Declaration

```swift
func enumerateObjects(options opts: NSEnumerationOptions = [], using block: (Any, Int, UnsafeMutablePointer<ObjCBool>) -> Void)
```

## Parameters

- `opts`: The options for the enumeration. For possible values, see doc://com.apple.foundation/documentation/Foundation/NSEnumerationOptions.
- `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. When the doc://com.apple.foundation/documentation/Foundation/NSEnumerationOptions/concurrent enumeration option is specified, enumeration stops after all of the currently running closures finish.

## Discussion

Discussion This method executes synchronously. By default, the enumeration starts with the first object and continues serially through the array to the last object. You can specify concurrent and/or reverse as enumeration options to modify this behavior.

## See Also

### Sending Messages to Elements

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