---
title: "index(after:)"
framework: Swift
role: symbol
role_heading: Instance Method
platforms: [iOS 27.0+, iPadOS 27.0+, Mac Catalyst 27.0+, macOS 27.0+, tvOS 27.0+, visionOS 27.0+, watchOS 27.0+]
path: "swift/uniquearray/index(after:)"
---

# index(after:)

Returns the position immediately after the given index.

## Declaration

```swift
func index(after index: Int) -> Int
```

## Parameters

- `index`: A valid index of the array. i must be less than endIndex.

## Return Value

Return Value The index immediately following i.

## Discussion

Discussion note: To improve performance, this method does not validate that the index is valid before incrementing it. Index validation is deferred until the resulting index is used to access an element. This optimization may be removed in future versions; do not rely on it. note: O(1)
