ModelKit is a simple to use model framework for Objective-C (Cocoa/iOS). It allows you to write your model layer quickly and easily, managing persistence (local and network) for you.
Before we jump into the how-to, it's important to understand what ModelKit is and isn't:
What Is It?
ModelKit was built to solve a few problems I consistently run into developing iPhone software. Namely:
- Persisting the model graph
- Integrating with a backend web service or BaaS (Backend as a Service) like Parse
- If using a backend, allowing the application to work offline.
I do a lot of consulting and inherit a lot of projects that use CoreData to store all of the data they pull off their JSON based REST-esque API. It is invariably a giant convoluted mess for what should be such a simple task. Need to upgrade a CoreData schema? Yeah, no thanks.
ModelKit could be considered CoreData-lite since it does most things that CoreData does. It attempts to accomplish these things in the simplest way possible. Therefore, it might not cover all the edge cases that CoreData does, nor does it ever intend to.
The other reason I needed something like ModelKit was to cover the holes in the iOS SDKs for certain BaaS services. While these SDKs are generally good for simple things like saving game scores, the more complicated your needs get, the bigger the holes they develop and the more boilerplate you end up writing. Since they typically aren't open sourced, you are left in the dark if you run head first into a wall.
What Does It Provide?
ModelKit gives you:
- A framework for building mildly complicated object graphs
- Persisting those graphs to local storage
- Querying the graph
- Tying the graph to a BaaS or your own custom backend REST API
- User system (backend)
- File uploads (backend)
- Push notifications (backend)
- Running custom backend code (backend)
- Simplistic and optimistic syncing (backend)
In addition to the Doxygen generated documentation included in the repo, more in-depth information can be found on the github wiki.
- About ModelKit
- Installation Guide
- Working With Models
- Querying Models
- Backend Services
- Setting Up The Service
- Making Your Models Usable With The Service
- Saving and Updating
- Deleting Models
- Fetching a Models Data
- Calling Backend Code