---
title: "layoutAttributesForItem(at:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionview/layoutattributesforitem(at:)"
---

# layoutAttributesForItem(at:)

Returns the layout information for the item at the specified index path.

## Declaration

```swift
func layoutAttributesForItem(at indexPath: IndexPath) -> NSCollectionViewLayoutAttributes?
```

## Parameters

- `indexPath`: The index path of the item.

## Return Value

Return Value The layout attributes of the item or nil if no item exists at the specified path.

## Discussion

Discussion This method updates the layout information as needed before returning the specified attributes. Always use this method to retrieve the layout attributes for items in the collection view. Do not query the layout object directly.

## See Also

### Getting Layout Information

- [layoutAttributesForSupplementaryElement(ofKind:at:)](appkit/nscollectionview/layoutattributesforsupplementaryelement(ofkind:at:).md)
