---
title: "makeItem(withIdentifier:for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionview/makeitem(withidentifier:for:)"
---

# makeItem(withIdentifier:for:)

Creates or returns a reusable item object of the specified type.

## Declaration

```swift
func makeItem(withIdentifier identifier: NSUserInterfaceItemIdentifier, for indexPath: IndexPath) -> NSCollectionViewItem
```

## Parameters

- `identifier`: The reuse identifier for the specified item. This is the identifier you specified when registering the item. This parameter must not be nil.
- `indexPath`: The index path specifying the location of the item. The data source object receives this information in its doc://com.apple.appkit/documentation/AppKit/NSCollectionViewDataSource/collectionView(_:itemForRepresentedObjectAt:) method and you should just pass it along.

## Return Value

Return Value A valid NSCollectionViewItem object.

## Discussion

Discussion This method looks for a recycled item object of the specified type and returns it if one exists. If one does not exist, it creates it using one of the following techniques: If you used the register(_:forItemWithIdentifier:) method to register a class for the identifier, this method instantiates your class and returns it. If you used the register(_:forItemWithIdentifier:) method to register a nib file for the identifier, this method loads the item from the nib file and returns it.

## See Also

### Creating Collection View Items

- [register(_:forItemWithIdentifier:)](appkit/nscollectionview/register(_:foritemwithidentifier:)-6s4i.md)
- [register(_:forItemWithIdentifier:)](appkit/nscollectionview/register(_:foritemwithidentifier:)-90h1i.md)
- [makeSupplementaryView(ofKind:withIdentifier:for:)](appkit/nscollectionview/makesupplementaryview(ofkind:withidentifier:for:).md)
- [register(_:forSupplementaryViewOfKind:withIdentifier:)](appkit/nscollectionview/register(_:forsupplementaryviewofkind:withidentifier:)-3dqa.md)
- [register(_:forSupplementaryViewOfKind:withIdentifier:)](appkit/nscollectionview/register(_:forsupplementaryviewofkind:withidentifier:)-7gvf2.md)
- [NSCollectionView.SupplementaryElementKind](appkit/nscollectionview/supplementaryelementkind.md)
- [NSUserInterfaceItemIdentifier](appkit/nsuserinterfaceitemidentifier.md)
