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


The NIActions class provides a generic interface for attaching actions to objects.

NIActions are used to implement user interaction in UITableViews and UICollectionViews via the corresponding classes (NITableViewActions and NICollectionViewActions) in the respective feature. NIActions separates the necessity

Types of Actions

The three primary types of actions are:

  • buttons,
  • detail views,
  • and pushing a new controller onto the navigation controller.

Attaching Actions

Actions may be attached to specific instances of objects or to entire classes of objects. When an action is attached to both a class of object and an instance of that class, only the instance action should be executed.

All attachment methods return the object that was provided. This makes it simple to attach actions within an array creation statement.

Actions come in two forms: blocks and selector invocations. Both can be attached to an object for each type of action and both will be executed, with the block being executed first. Blocks should be used for simple executions while selectors should be used when the action is complex.

The following is an example of using NITableViewActions:

NSArray *objects = @[
[NITitleCellObject objectWithTitle:@"Implicit tap handler"],
[self.actions attachToObject:[NITitleCellObject objectWithTitle:@"Explicit tap handler"]
^BOOL(id object, id target) {
NSLog(@"Object was tapped with an explicit action: %@", object);
[self.actions attachToClass:[NITitleCellObject class]
^BOOL(id object, id target) {
NSLog(@"Object was tapped: %@", object);
Inheritance diagram for NIActions:
NICollectionViewActions NITableViewActions


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: