Similar to Refactoring 3 different UI components into one UIView into a CocoaPod but I think maybe I'm doing the core refactoring wrong.
So, I have a 3 UIView
elements that I am consistently reusing:
- label
- input
- check mark
There is some validation and other logic that I want to refactor as well (as in stay with the new class so the logic is also reused).
So, do I want to start off with a UIViewController
sub class and add that everywhere I used these element or a UIView
?
I don't see how UIVew
should/could have the validation logic required. So, then I would need to have a UIViewController
. But this doesn't make a lot of sense to me, since you have UIView
objects on in your views, not UIVIewController
objects.
Thoughts?
EDIT:
- What validations?
- basically there is a label, input and check box.
- when the user enters text the label changes colour and the check mark changes state depending on validation (I was actually going to do validation delegate)
- when the user is done editing and all good, check mark is green & label changes colour again.