-
Notifications
You must be signed in to change notification settings - Fork 1
Model
A model is a class representing the business logic of your application. Models are subclasses of ISModel
class. An ISModel
instance has a dictionary of key/value object called attributes. You can add an attribute, clear it, or update it.
When a model instance is represented by a server-backed instance, these attributes are populated from the server when you do fetch on the model instance.
For example, if you have a database table on the server called notes, a Note instance will represent a specific-row in the database to be used by the iOS client. If the notes table has three columns (title, body, and create_at), then when you fetch the model instance, the attributes dictionary will have three key/value entries, each for one of these column values.
Usually, server-backed applications utilize some sort of "id" column to uniquely identify a given row in a table. In this case, an "id" attribute is added to the attributes dictionary. By default, the "id" key is called id. However, you can change this
behavior in your subclass of ISModel
by overriding idAttribute
method and returning the key value (e.g., @"name").