MyFormworks / Formworks

Formworks is a framework for building forms from JSON files.
https://myformworks.github.io/Formworks/
MIT License
6 stars 1 forks source link

Main view controller to host UI Components #4

Closed csfar closed 4 years ago

csfar commented 4 years ago

What is an UI Component? A UI Component is a representation of one of many types of inputs available in a form. It is composed of a UIViewController and a ViewModel, which communicates with its UIViewController through the Protocol-delegate pattern. A UI Component should only be instantiated as part of a root UIViewController through UIViewController containment.

What is a root UIViewController? A root UIViewController, named in code as RootViewController, is a UIViewController responsible for being the container of all the UI Components of a given form. This object is the one responsible for the instantiation of each UI Component and for receiving and sending data to the "outside world".

This first implementation will be simple and will require refactoring, likely sooner than we think. However, establishing this primary contact with other parts of the framework will give us a better grasp of what the architecture of our codebase should be. Ideally, each UIViewController should have a ViewModel, but for this first implementation an empty class will be enough.

EdgSgroi commented 4 years ago

O RootViewController vai ter um ViewModel também?

VicFalcetta commented 4 years ago

Eu acredito que seria bom ter, para assim o próprio ViewModel ser encarregado da parte de cuidar dos dados e não deixar totalmente ligado a Controller. Desse jeito pode deixar mais modularizado e em teoria mais fácil de fazer alterações sem afetar outras estruturas.

csfar commented 4 years ago

O RootViewController vai ter um ViewModel também?

A princípio sim mas ainda não sabemos o que ele vai ter exatamente. A ideia é que o ViewModel retire da ViewController algumas funções como fazer o parse do JSON e etc. Conforme vamos definindo mais a arquitetura da framework o ViewModel do RootViewController vai ficando mais claro.