---
title: "newItem(forRepresentedObject:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionview/newitem(forrepresentedobject:)"
---

# newItem(forRepresentedObject:)

Returns the collection view item that is used for the specified object.

## Declaration

```swift
func newItem(forRepresentedObject object: Any) -> NSCollectionViewItem
```

## Parameters

- `object`: The content object that the collection view item will represent.

## Return Value

Return Value An initialized collection view item with the specified object and the appropriate view set. The collection view item should not be autoreleased.

## Discussion

Discussion Whenever possible, register classes or nib files for your items instead of using this property. For more information, see Creating Collection View Items. Subclasses can override this method if the collection view items are not generated from a prototype or if the prototype view needs to be modified. The subclass is responsible for setting the view  and representedObject of the new collection view item.

## See Also

### Legacy Collection View Support

- [itemPrototype](appkit/nscollectionview/itemprototype.md)
- [selectionIndexes](appkit/nscollectionview/selectionindexes.md)
- [maxNumberOfRows](appkit/nscollectionview/maxnumberofrows.md)
- [maxNumberOfColumns](appkit/nscollectionview/maxnumberofcolumns.md)
- [minItemSize](appkit/nscollectionview/minitemsize.md)
- [maxItemSize](appkit/nscollectionview/maxitemsize.md)
- [item(at:)](appkit/nscollectionview/item(at:)-80xze.md)
- [frameForItem(at:)](appkit/nscollectionview/frameforitem(at:).md)
- [frameForItem(at:withNumberOfItems:)](appkit/nscollectionview/frameforitem(at:withnumberofitems:).md)
- [draggingImageForItems(at:with:offset:)](appkit/nscollectionview/draggingimageforitems(at:with:offset:)-951w7.md)
- [setDraggingSourceOperationMask(_:forLocal:)](appkit/nscollectionview/setdraggingsourceoperationmask(_:forlocal:).md)
