Or how to build scrolling stack container and keep an healthy usage of the memory.

In these days mobile UIs became a complex job; lists (tables or, more often, collections) may contains heterogeneous groups of items, showing in a single scroll interaction a great amount of data.

Take for example the IMDB application; the home page contains:

  • an horizontal list with the highlighted movies
  • highlighted news
  • an horizontal list with photo gallery
  • an horizontal list with nearby movies
  • another horizontal list with coming soon movies
  • vertical list of news
  • … and yeah, much more stuff

everything inside a single vertical scroll view!

Usually, if you still lack attention while writing this kind of code, your view controllers are likely to become a massive piece of spaghetti code, assembling several responsibilities and making your app more fragile and much less testable.
That’s the world of Massive View Controllers and the main reason behind alternative architectures like Viper, MMVM and several others.

Separation of concerns (along with Single Responsibility Principle) is a design principle for separating a computer program into distinct sections, such that each section addresses a separate concern.

View the article