---
title: "filteredIndexSet(in:includeInteger:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/indexset/filteredindexset(in:includeinteger:)-6cdvc"
---

# filteredIndexSet(in:includeInteger:)

Returns an IndexSet filtered according to the result of includeInteger.

## Declaration

```swift
func filteredIndexSet(in range: Range<IndexSet.Element>, includeInteger: (IndexSet.Element) throws -> Bool) rethrows -> IndexSet
```

## Parameters

- `range`: A range of integers. For each integer in the range that intersects the integers in the IndexSet, then the includeInteger predicate will be invoked.
- `includeInteger`: The predicate which decides if an integer will be included in the result or not.

## See Also

### Selecting Elements

- [filteredIndexSet(in:includeInteger:)](foundation/indexset/filteredindexset(in:includeinteger:)-9dn86.md)
- [filteredIndexSet(includeInteger:)](foundation/indexset/filteredindexset(includeinteger:).md)
