Contents

makeItem(withIdentifier:for:)

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

Declaration

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 Collectionview(_:itemforrepresentedobjectat:) method and you should just pass it along.

Return Value

A valid NSCollectionViewItem object.

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:

See Also

Creating Collection View Items