---
title: "formIndex(before:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/anyrandomaccesscollection/formindex(before:)"
---

# formIndex(before:)

Replaces the given index with its predecessor.

## Declaration

```swift
func formIndex(before i: inout AnyRandomAccessCollection<Element>.Index)
```

## Parameters

- `i`: A valid index of the collection. i must be greater than startIndex.
