Lecture: Core Data and NSFetchedResultsController
Practice using basic Core Data skills by implementing NSFetchedResultController to display saved recipes in a table view.
Core Data is an amazingly powerful framework if you can be flexible to its ins and outs. When I initially learned about Core Data, I fought hard against the differences I noticed between populating a table view with a simple array rather than implementing an NSFetchedResultsController. The main message I wanted to convey to my students in this lecture was that Core Data is not only a powerful way to persist data, it has a lot of amazing features like NSSortDescriptors that can make filtering through stored information simple and swifty.
In this application, I had my students configure a master-detail interface to work with Core Data for creating, updating, fetching, and deleting instances of recipes. Students got practice working with a single managed object context to utilize an NSFetchedResults controller that would pull the stored data and display it in a table view for easy access. We played around with some NSSortDescriptors to organize fetched results into their respective cuisine categories.
I used to really struggle with finding things to like about Core Data, and now I absolutely love it! I was happy to see all of my 15 students voluntarily attend this optional lecture and they mentioned how they wanted to focus on using Core Data in a majority of their projects going forward.
The repository for the completed project can be found here.