|The NIMutableCollectionViewModel class is a mutable collection view model. More...|
|A protocol for NIMutableTableViewModel to handle editing states for objects. More...|
|The NIMutableTableViewModel class is a mutable table view model. More...|
|A non-mutable table view model that complies to the UITableViewDataSource protocol. More...|
|A protocol for NITableViewModel to fetch rows to be displayed for the table view. More...|
Nimbus table view models make building table views remarkably easy.
Rather than implement the data source methods in each table view controller, you assign a model to self.tableView.dataSource and only think about row creation.
Nimbus table view models implement many of the standard table view data source methods, including methods for section titles, grouped rows, and section indices. By providing this functionality in one object, Nimbus provides much more efficient implementations than one-off implementations that might otherwise be copied from one controller to another.
In order to use the Nimbus table view model you create a model, assign it to your table view's data source after the table view has been created, and implement the model delegate to create the table view cells. You can use the Nimbus cell factory to avoid implementing the model delegate.
Below is an example of creating a basic list model:
Below is an example of creating a basic sectioned model:
Both of the above examples would implement the model delegate like so:
Let's say you want to create a form for a user to enter their username and password. You can easily do this with Nimbus using the Nimbus cell factory and the Nimbus form elements from the table cell catalog.
When the user then hits the button to sign in, you can grab the values from the model by using the elementWithID: category method added to NITableViewModel by the form support.
See example: Static Table Model Creation