---
title: "index(before:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/data/index(before:)"
---

# index(before:)

Returns the index that immediately precedes the specified index.

## Declaration

```swift
func index(before i: Data.Index) -> Data.Index
```

## See Also

### Manipulating Indexes

- [Data.Index](foundation/data/index.md)
- [startIndex](foundation/data/startindex.md)
- [endIndex](foundation/data/endindex.md)
- [index(after:)](foundation/data/index(after:).md)
