---
title: "item(at:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionview/item(at:)-2vx2h"
---

# item(at:)

Returns the item associated with the specified index path.

## Declaration

```swift
func item(at indexPath: IndexPath) -> NSCollectionViewItem?
```

## Parameters

- `indexPath`: The index path whose item you want.

## Return Value

Return Value The item for the specified index path or nil if no item is available.

## Discussion

Discussion For efficiency, the collection view does not create items until they are needed, and usually it creates them only when they need to be displayed onscreen. If the collection view does not currently have an item for the specified index path, because that item would be positioned offscreen, this method returns nil.

## See Also

### Locating Items and Views

- [visibleItems()](appkit/nscollectionview/visibleitems().md)
- [indexPathsForVisibleItems()](appkit/nscollectionview/indexpathsforvisibleitems().md)
- [visibleSupplementaryViews(ofKind:)](appkit/nscollectionview/visiblesupplementaryviews(ofkind:).md)
- [indexPathsForVisibleSupplementaryElements(ofKind:)](appkit/nscollectionview/indexpathsforvisiblesupplementaryelements(ofkind:).md)
- [indexPath(for:)](appkit/nscollectionview/indexpath(for:).md)
- [indexPathForItem(at:)](appkit/nscollectionview/indexpathforitem(at:).md)
- [supplementaryView(forElementKind:at:)](appkit/nscollectionview/supplementaryview(forelementkind:at:).md)
- [scrollToItems(at:scrollPosition:)](appkit/nscollectionview/scrolltoitems(at:scrollposition:).md)
