Contents

item(at:)

Returns the item associated with the specified index path.

Declaration

func item(at indexPath: IndexPath) -> NSCollectionViewItem?

Parameters

  • indexPath:

    The index path whose item you want.

Return Value

The item for the specified index path or nil if no item is available.

Discussion

For efficiency, the collection view does not create items until they are needed, and usually it creates them only when they need to be displayed onscreen. If the collection view does not currently have an item for the specified index path, because that item would be positioned offscreen, this method returns nil.

See Also

Locating Items and Views