The iOS framework that grows only as fast as its documentation
<NIMutableTableViewModelDelegate> Protocol Reference

Overview

A protocol for NIMutableTableViewModel to handle editing states for objects.

Inheritance diagram for <NIMutableTableViewModelDelegate>:
<NITableViewModelDelegate>

Tasks

(BOOL) - tableViewModel:canEditObject:atIndexPath:inTableView:
 
(BOOL) - tableViewModel:canMoveObject:atIndexPath:inTableView:
 
(BOOL) - tableViewModel:shouldMoveObject:atIndexPath:toIndexPath:inTableView:
 
(UITableViewRowAnimation) - tableViewModel:deleteRowAnimationForObject:atIndexPath:inTableView:
 
(BOOL) - tableViewModel:shouldDeleteObject:atIndexPath:inTableView:
 
(UITableViewCell *) - tableViewModel:cellForTableView:atIndexPath:withObject:
 

Method Documentation

tableViewModel:canEditObject:atIndexPath:inTableView:

Asks the receiver whether the object at the given index path should be editable.

- (BOOL)tableViewModel:(NIMutableTableViewModel *)tableViewModel canEditObject:(id)object atIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView;
Discussion

If this method is not implemented, the default response is assumed to be NO.

tableViewModel:canMoveObject:atIndexPath:inTableView:

Asks the receiver whether the object at the given index path should be moveable.

- (BOOL)tableViewModel:(NIMutableTableViewModel *)tableViewModel canMoveObject:(id)object atIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView;
Discussion

If this method is not implemented, the default response is assumed to be NO.

tableViewModel:shouldMoveObject:atIndexPath:toIndexPath:inTableView:

Asks the receiver whether the given object should be moved.

- (BOOL)tableViewModel:(NIMutableTableViewModel *)tableViewModel shouldMoveObject:(id)object atIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)toIndexPath inTableView:(UITableView *)tableView;
Discussion

If this method is not implemented, the default response is assumed to be YES.

Returning NO will stop the model from handling the move logic.

tableViewModel:deleteRowAnimationForObject:atIndexPath:inTableView:

Asks the receiver what animation should be used when deleting the object at the given index path.

- (UITableViewRowAnimation)tableViewModel:(NIMutableTableViewModel *)tableViewModel deleteRowAnimationForObject:(id)object atIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView;
Discussion

If this method is not implemented, the default response is assumed to be UITableViewRowAnimationAutomatic.

tableViewModel:shouldDeleteObject:atIndexPath:inTableView:

Asks the receiver whether the given object should be deleted.

- (BOOL)tableViewModel:(NIMutableTableViewModel *)tableViewModel shouldDeleteObject:(id)object atIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView;
Discussion

If this method is not implemented, the default response is assumed to be YES.

Returning NO will stop the model from handling the deletion logic. This is a good opportunity for you to show a UIAlertView or similar feedback prompt to the user before initiating the deletion yourself.

If you implement the deletion of the object yourself, your code may resemble the following:

NSArray *indexPaths = [self removeObjectAtIndexPath:indexPath];
[tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic];

tableViewModel:cellForTableView:atIndexPath:withObject:

Fetches a table view cell at a given index path with a given object.

- (UITableViewCell*)tableViewModel:(NITableViewModel *)tableViewModel cellForTableView:(UITableView *)tableView atIndexPath:(NSIndexPath *)indexPath withObject:(id)object;
Discussion

The implementation of this method will generally use object to customize the cell.

Reimplemented in NICellFactory.