Instance Property

indexPathsForVisibleItems

An array of the visible items in the collection view.

Declaration

var indexPathsForVisibleItems: [IndexPath] { get }

Discussion

The value of this property is an unsorted array of NSIndexPath objects, each of which corresponds to a visible cell in the collection view. This array does not include any supplementary views that are currently visible. If there are no visible items, the value of this property is an empty array.

See Also

Locating Items and Views in the Collection View

func indexPathForItem(at: CGPoint) -> IndexPath?

Returns the index path of the item at the specified point in the collection view.

func indexPath(for: UICollectionViewCell) -> IndexPath?

Returns the index path of the specified cell.

func cellForItem(at: IndexPath) -> UICollectionViewCell?

Returns the visible cell object at the specified index path.

func indexPathsForVisibleSupplementaryElements(ofKind: String) -> [IndexPath]

Returns the index paths of all visible supplementary views of the specified type.

func visibleSupplementaryViews(ofKind: String) -> [UICollectionReusableView]

Returns an array of the visible supplementary views of the specified kind.