---
title: NSCollectionViewElement
framework: appkit
role: symbol
role_heading: Protocol
path: appkit/nscollectionviewelement
---

# NSCollectionViewElement

A set of methods that you use to manage the content in a collection view.

## Declaration

```swift
protocol NSCollectionViewElement : NSUserInterfaceItemIdentification, NSObjectProtocol
```

## Overview

Overview Adopt this protocol in the classes that you use to display content for items, supplementary views, and decoration views in a collection view. The methods of this protocol are optional and provide support for applying layout attributes and for cleaning up elements when they move offscreen and are recycled. Collection view items—that is, instances of the NSCollectionViewItem class—already adopt this protocol. For supplementary and decoration views, adopt this protocol in the custom view classes you use to represent that content.

## Topics

### Reusing Elements

- [prepareForReuse()](appkit/nscollectionviewelement/prepareforreuse().md)

### Managing Layout Changes

- [preferredLayoutAttributesFitting(_:)](appkit/nscollectionviewelement/preferredlayoutattributesfitting(_:).md)
- [apply(_:)](appkit/nscollectionviewelement/apply(_:).md)
- [willTransition(from:to:)](appkit/nscollectionviewelement/willtransition(from:to:).md)
- [didTransition(from:to:)](appkit/nscollectionviewelement/didtransition(from:to:).md)

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSUserInterfaceItemIdentification](appkit/nsuserinterfaceitemidentification.md)

### Inherited By

- [NSCollectionViewSectionHeaderView](appkit/nscollectionviewsectionheaderview.md)

### Conforming Types

- [NSCollectionViewItem](appkit/nscollectionviewitem.md)

## See Also

### Items

- [NSCollectionViewItem](appkit/nscollectionviewitem.md)
