I read a lot of articles about the clean architecture of VIPER iOS, I understand that the main puropose: separation of problems.
I am currently using it for my project. I have modules, each of which is divided into representations, interactors, presenters, objects and routers (with layout).
I have a module: Address and Add submodule for an additional address page.
So, I have my View protocol implemented by my UIViewController. The view controller contains all weak labels and text fields of IBOutlet (for the new address form).
The address form contains several fields, such as:
- user name and surname
- postcode
- Country
- state
- telephone
- Email
- etc...
In my case, the facilitator simply relies on user interaction with the interactor who makes the API call.
But before making the API call, I want to pre-check the form to avoid using a useless network resource.
I need to check for example:
- contents of the country and tell the point of view that the field is required if empty ...
- email format and inform the viewer that this field is invalid ...
My question is where can I put my form validation code?
Which VIPER component should fill this job?
Thank you in advance!
source share