Inlab Exercise (3/28)
- Use Core Data for persistence of model data
- Use a fetched results controller for caching and to help map model data to table view cells
- Get a start on modeling the entities for the data set you will be using in the second assignment
For this (non-graded) in-lab exercise, you should start by creating a Master-Detail Application with the "Use Core Data" option checked. You'll likely be using this as a basis for your second assignment (which asks you to build a visualization tool for a data set of your choice), so you should name your project and view controllers accordingly.
Your goal for this inlab is to create the necessary entity descriptions using the Xcode data modeling tools and to create a root level view controller that allows you select from a number of different fetch requests to execute, the results of which will in turn be displayed in second-level list controllers.
The root view would look something like this:
And tapping on a cell (whose name should reflect the associated fetch request) will push another view controller onto the stack which executes a fetch request to retrieve the necessary core data managed objects, whose names are displayed in a table view. The view corresponding to the two cells above follow:
Tapping on the "+" button in any of the second level list views should add a new managed object of the appropriate entity type to the underlying managed object context. You may simply choose to fill the new managed object with default values for now.
Finally, you'll also want to implement a detail view controller as well that displays detailed model information of a given managed object (when tapped in the above list view).
If you've done this all correctly, then you should also have auto-persistence at this point! Terminate the app and restart to check -- hurrah! (Otherwise, go back and make sure that you've created your managed objects and called the managed object context's
save method correctly.)