---
title: "index(_:offsetByRuns:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/attributedstringprotocol/index(_:offsetbyruns:)"
---

# index(_:offsetByRuns:)

Returns the position of the run offset a given number of runs from a given string index.

## Declaration

```swift
func index(_ i: AttributedString.Index, offsetByRuns distance: Int) -> AttributedString.Index
```

## Parameters

- `i`: The index of a position in the string.
- `distance`: The number of runs to advance by.

## Return Value

Return Value The position of the run offset distance runs from position i.

## See Also

### Accessing Indices

- [startIndex](foundation/attributedstringprotocol/startindex.md)
- [endIndex](foundation/attributedstringprotocol/endindex.md)
- [index(_:offsetByCharacters:)](foundation/attributedstringprotocol/index(_:offsetbycharacters:).md)
- [index(_:offsetByUnicodeScalars:)](foundation/attributedstringprotocol/index(_:offsetbyunicodescalars:).md)
- [index(afterCharacter:)](foundation/attributedstringprotocol/index(aftercharacter:).md)
- [index(afterRun:)](foundation/attributedstringprotocol/index(afterrun:).md)
- [index(afterUnicodeScalar:)](foundation/attributedstringprotocol/index(afterunicodescalar:).md)
- [index(beforeCharacter:)](foundation/attributedstringprotocol/index(beforecharacter:).md)
- [index(beforeRun:)](foundation/attributedstringprotocol/index(beforerun:).md)
- [index(beforeUnicodeScalar:)](foundation/attributedstringprotocol/index(beforeunicodescalar:).md)
- [AttributedString.Index](foundation/attributedstring/index.md)
