I read many articles about the clean iOS architecture VIPER, I understand the main puropose: the separation of concerns.
I currently use it for my project. I have modules, each split by Views, Interactors, Presenters, Entities and Routers (with Storyboard).
I have a module: Address and a submodule Add for the add address page.
So, I have my protocol View implemented by my UIViewController. The view controller holds all weak IBOutlet labels and text fields (for the new address form).
The address form contains few fields like:
- person first name and last name
- postcode
- country
- state
- phone
- etc...
In my case the presenter just relies user interactions to the interactor which performs the API call.
But, before performing the API call, I want to pre-validate the form to avoid consume useless network resource.
I need to check for example:
- the content of country and tell to the view that field is required if empty...
- the format of email and tell to the view that field is invalid...
My question is, where can I put my form validation code?
Which VIPER component should be fill that job?
Thank you in advance!