ReadingList
ReadingList copied to clipboard
An example on using the Mantle Modeling Framework with Overcoat AFNetworking extension.
ReadingList
ReadingList is a sample application that shows how to create a Web Service Client and the corresponding model layer using Mantle Modeling Framework and the Overcoat AFNetworking extension. Specifically, ReadingList allows you to search for books in the iBooks Store and save them in a local database. It won't get an Apple Design Award, but it is a fairly complete real life example.



Installation
In order to build and run ReadingList, you must install first project dependencies via CocoaPods. To do so:
$ gem install cocoapods # If necessary
$ cd ReadingList
$ pod install
Once CocoaPods has finished the installation, open the generated ReadingList.xcworkspace using Xcode and run the sample.
The Model
The best place to start understanding this sample is the TGRBook class, which models every property the that the application needs to know about a book.
TGRBook also implements MTLJSONSerializing and MTLManagedObjectSerializing to allow JSON and Core Data entity serialization respectively.
The Web Service
ReadingList book search functionality is built around the iTunes Search Web Service.
TGRBookCatalog is the OVCClient subclass that implements this functionality with a few lines of code.
Other Goodies
ReadingList uses some techniques and patterns that are worth mentioning:
TGRBookSearchControllershows how to separate search UI functionality from the View Controller.TGRArrayDataSourceandTGRFetchedResultsControllerDataSourceare reusable classes that implementUITableViewdata sources usingNSArrayandNSFetchedResultsControllerrespectively.TGRFetchedResultsTableViewControlleris a reusableUITableViewControllersubclass that processesNSFetchedResultsControllercontent changes the right way (based on code seen here).
Contact
Guillermo Gonzalez
@gonzalezreal
License
ReadingList is available under the MIT license. See LICENSE.md.