samedi 11 juillet 2020

Refactoring View Controller to fit the MVC design pattern - Swift

I understand the basics/definition of the MVC design pattern. A couple things I cannot get a super clear answer on (looking for more practical explanation, rather than theory or definition).

I have boiled it down to two main questions that I have:

  1. Where is the best place to store the structural/design functions for a Table View & Collection View? These include things like frame customization, number of rows/sections, delegate/datasource access, cell structure, etc. All of these "formatting" functions really seem to be cluttering up my two View Controllers.

  2. Where is the best place to store logic that deals with grabbing data, filtering it, and then sending it to the View? Currently, that is stored in the View Controller but I am wondering if I should put a bulk of that in the Model? I have read differing opinions about putting that type of logic in the Model.

Thanks for any help offered!

Aucun commentaire:

Enregistrer un commentaire