The iOS framework that grows only as fast as its documentation
NICollectionViewActions Class Reference


The NICollectionViewActions class provides an interface for attaching actions to objects in a NICollectionViewModel.

Basic Use

NICollectionViewModel and NICollectionViewActions cooperate to solve two related tasks: data representation and user actions, respectively. A NICollectionViewModel is composed of objects and NICollectionViewActions maintains a mapping of actions to these objects. The object's attached actions are executed when the user interacts with the cell representing an object.

Delegate Forwarding

Your delegate implementation can call the listed collectionView: methods in order for the collection view to respond to user actions. Notably shouldHighlightItemAtIndexPath: allows cells to be highlighted only if the cell's object has an attached action. didSelectItemAtIndexPath: will execute the object's attached tap actions.

If you use the delegate forwarders your collection view's data source must be an instance of NICollectionViewModel.

Inheritance diagram for NICollectionViewActions:


(BOOL) - collectionView:shouldHighlightItemAtIndexPath:
(void) - collectionView:didSelectItemAtIndexPath:
Creating Table View Actions
(id) - initWithTarget:
Mapping Objects
(id) - attachToObject:tapBlock:
(id) - attachToObject:detailBlock:
(id) - attachToObject:navigationBlock:
(id) - attachToObject:tapSelector:
(id) - attachToObject:detailSelector:
(id) - attachToObject:navigationSelector:
Mapping Classes
(void) - attachToClass:tapBlock:
(void) - attachToClass:detailBlock:
(void) - attachToClass:navigationBlock:
(void) - attachToClass:tapSelector:
(void) - attachToClass:detailSelector:
(void) - attachToClass:navigationSelector:
Object State
(BOOL) - isObjectActionable:
(id) + objectFromKeyClass:map:

Method Documentation


Asks the receiver whether the object at the given index path is actionable.

- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath;

collectionView.dataSource must be a NICollectionViewModel.

YES if the object at the given index path is actionable.


Asks the receiver to perform the tap action for an object at the given indexPath.

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath;

collectionView.dataSource must be a NICollectionViewModel.