Representing Data with Models
We’ve covered views and controllers, but where’s the love for the M in MVC? Well, wait no more, because we’re going to dive into models. We now understand views and controllers, but in practice models will play just as big of a role as the sexier, user-facing code.
In iOS, there are two big components to models: CoreData and, well, everything else. CoreData is an iOS object graph and persistence framework, sort of similar to ActiveRecord in Rails-land. It’s an incredibly powerful framework to save and query objects using a database, so it deserves a chapter or even a book onto its own. But even without touching CoreData, we can do a whole lot with just “everything else” about models. It’s time to get down to business.