---
title: "index(passingTest:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsindexset/index(passingtest:)"
---

# index(passingTest:)

Returns the index of the first object that passes the predicate Block test.

## Declaration

```swift
func index(passingTest predicate: (Int, UnsafeMutablePointer<ObjCBool>) -> Bool) -> Int
```

## Parameters

- `predicate`: The Block to apply to elements in the set. The Block takes two arguments: The Block returns a Boolean value that indicates whether obj passed the test.

## Return Value

Return Value The index of the first object that passes the predicate test.

## See Also

### Querying Index Sets

- [contains(_:)](foundation/nsindexset/contains(_:)-bb19.md)
- [contains(_:)](foundation/nsindexset/contains(_:)-5j2kh.md)
- [contains(in:)](foundation/nsindexset/contains(in:).md)
- [intersects(in:)](foundation/nsindexset/intersects(in:).md)
- [count](foundation/nsindexset/count.md)
- [countOfIndexes(in:)](foundation/nsindexset/countofindexes(in:).md)
- [indexes(passingTest:)](foundation/nsindexset/indexes(passingtest:).md)
- [index(options:passingTest:)](foundation/nsindexset/index(options:passingtest:).md)
- [indexes(options:passingTest:)](foundation/nsindexset/indexes(options:passingtest:).md)
- [index(in:options:passingTest:)](foundation/nsindexset/index(in:options:passingtest:).md)
- [indexes(in:options:passingTest:)](foundation/nsindexset/indexes(in:options:passingtest:).md)
