---
title: "enumerate(options:using:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsindexset/enumerate(options:using:)"
---

# enumerate(options:using:)

Executes a given Block over the index set’s indexes, using the specified enumeration options.

## Declaration

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

## Parameters

- `opts`: A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order). See doc://com.apple.foundation/documentation/Foundation/NSEnumerationOptions for the supported values.
- `block`: The Block to apply to elements in the set. The Block takes two arguments:

## Discussion

Discussion This method executes synchronously.

## See Also

### Enumerating Indexes

- [enumerate(_:)](foundation/nsindexset/enumerate(_:).md)
- [enumerate(in:options:using:)](foundation/nsindexset/enumerate(in:options:using:).md)
- [makeIterator()](foundation/nsindexset/makeiterator().md)
- [NSIndexSetIterator](foundation/nsindexsetiterator.md)
