Instance Method

collectionView(_:shouldSpringLoadItemAt:with:)

Returns a Boolean value indicating whether you want the spring-loading interaction effect displayed for the specified item.

Declaration

optional func collectionView(_ collectionView: UICollectionView, shouldSpringLoadItemAt indexPath: IndexPath, with context: UISpringLoadedInteractionContext) -> Bool

Parameters

collectionView

The collection view object notifying you of the interaction.

indexPath

The index path of the item for which the spring-loading behavior applies.

context

A context object containing information about the item and view on which to display the spring-loading interaction.

Return Value

true to apply the spring-loading behavior for the item or false to suppress the behavior altogether.

Discussion

If you do not implement this method, the collection view assumes a return value of true.