I’m using Apple’s UIPageViewController template, which includes a “ModelController” class. I use this class to return individual pages in the form of a viewcontroller, but how much setup is the Model class responsible for? For example, I have a plist that contains an array of image layout info for each page. Should the model hold the entire array, and then set each viewcontroller with its specific layout information, or should each viewcontroller just get its own layout info? What exactly should the model take care of?
I’m using Apple’s UIPageViewController template, which includes a ModelController class. I use this class
Share
I would suggest to make the model as heavy as possible, and the viewcontoller as light as possible
Another thing is to use lazy initialization for the image in the viewcontollers
So ideally the model will contain the array of the names of all the images that you wish to load, and each time a new page is generated load the image and add it to the viewcontoller that you will create.
The viewcontroller will have all the information needed for it, this means that you could use this same viewcontoller as a stand alone controller outside of the context of pageviewcontroller
So the model will be only responsible to load the required variables,
the access to these files, the loading of the images will be done in the viewcontroller, in a way that viewcontroller will only receive strings as parameters, and the loading logic is done inside the viewcontoller, hence decoupling the views as much as you can