According to the MVC pattern, you have three separate components: Model, View, Controller.
In iOS, a viewController
plays the role of the Controller in the MVC pattern - it is meant to handle the communication between your view and the data.
The viewController's view
property plays the role of View in the MVC pattern - this is the UI to be displayed.
How you implement the Model portion is up to you, but from what I understand from your question it looks like you have two responsibilities - a data object that holds your information, and storage of that data (in JSON).
I would create two classes for this, one that is just a data object (called Person
or something, not sure what your use case is) that has properties for whatever data you need to store, and very few (if any) actual methods. The second would be some kind of storage class where you pass in Persons to be stored, and query them back (i.e. getAll
, getFavorites
, etc...). This class would handle conversion to and from JSON, and its interface would deal exclusively with Person objects.
Your controllers would then query this storage class, retrieve an array of Persons, and display them somehow (in a table it looks like).