---
title: "init(forItem:inSection:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsindexpath/init(foritem:insection:)"
---

# init(forItem:inSection:)

Initializes an index path with the indexes of a specific item and section in a collection view.

## Declaration

```swift
convenience init(forItem item: Int, inSection section: Int)
```

```swift
convenience init(item: Int, section: Int)
```

```swift
init(forItem item: Int, inSection section: Int)
```

## Parameters

- `item`: An index number identifying an item in a doc://com.apple.documentation/documentation/UIKit/UICollectionView object in a section identified by the section parameter.
- `section`: An index number identifying a section in a doc://com.apple.documentation/documentation/UIKit/UICollectionView object.

## Return Value

Return Value An NSIndexPath object.

## See Also

### Using Special Node Names

- [init(forRow:inSection:)](foundation/nsindexpath/init(forrow:insection:).md)
- [section](foundation/nsindexpath/section.md)
- [row](foundation/nsindexpath/row.md)
- [item](foundation/nsindexpath/item.md)
