---
title: "indexes(ofObjectsAt:options:passingTest:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsorderedset/indexes(ofobjectsat:options:passingtest:)"
---

# indexes(ofObjectsAt:options:passingTest:)

Returns the index, from a given set of indexes, of the object in the ordered set that passes a test in a given block for a given set of enumeration options.

## Declaration

```swift
func indexes(ofObjectsAt s: IndexSet, options opts: NSEnumerationOptions = [], passingTest predicate: (Any, Int, UnsafeMutablePointer<ObjCBool>) -> Bool) -> IndexSet
```

## Parameters

- `s`: The indexes of the objects over which to enumerate.
- `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).
- `predicate`: The block to apply to elements in the ordered set. The block takes three arguments: The block returns a Boolean value that indicates whether obj passed the test.

## Return Value

Return Value The index of the corresponding value in the ordered set that passes the test specified by predicate. If no objects in the ordered set pass the test, returns NSNotFound.

## Discussion

Discussion By default, the enumeration starts with the first object and continues serially through the ordered set to the last object. You can specify concurrent and/or reverse as enumeration options to modify this behavior. important: If the block parameter or s is nil this method will raise an exception.

## See Also

### Accessing Set Members

- [contains(_:)](foundation/nsorderedset/contains(_:).md)
- [enumerateObjects(at:options:using:)](foundation/nsorderedset/enumerateobjects(at:options:using:).md)
- [enumerateObjects(_:)](foundation/nsorderedset/enumerateobjects(_:).md)
- [enumerateObjects(options:using:)](foundation/nsorderedset/enumerateobjects(options:using:).md)
- [firstObject](foundation/nsorderedset/firstobject.md)
- [lastObject](foundation/nsorderedset/lastobject.md)
- [object(at:)](foundation/nsorderedset/object(at:).md)
- [subscript(_:)](foundation/nsorderedset/subscript(_:).md)
- [objects(at:)](foundation/nsorderedset/objects(at:).md)
- [index(of:)](foundation/nsorderedset/index(of:).md)
- [index(of:inSortedRange:options:usingComparator:)](foundation/nsorderedset/index(of:insortedrange:options:usingcomparator:).md)
- [index(ofObjectAt:options:passingTest:)](foundation/nsorderedset/index(ofobjectat:options:passingtest:).md)
- [index(ofObjectPassingTest:)](foundation/nsorderedset/index(ofobjectpassingtest:).md)
- [index(_:ofObjectPassingTest:)](foundation/nsorderedset/index(_:ofobjectpassingtest:).md)
- [indexes(ofObjectsPassingTest:)](foundation/nsorderedset/indexes(ofobjectspassingtest:).md)
