mardi 16 avril 2019

Similar labels with the same logic in different views, how can I manage their content ideally?

Just took over a project and the whole "design" isn't perfect. But I try to start with as little changes as possible. I have 4 similar views that show similar data. So far the logic what is displayed has been programmed 4 times in all of them separately and I want to create now a "Layouter" class, which individually manages the labels, colors etc. of these 4 views. However I am a bit clueless how I can do that. I thought about passing all the labels etc. by reference to this class from the respective view controller (since their position etc is set in Xcode and also some other stuff within the viewcontroller) but this seems a bit unclean. Is there any other way? Some design pattern? The labels etc. are IBOutlets of these viewcontrollers. Of course I could rip everything apart and create a new view within this viewcontroller of which the IBOutlets are linked to this manager class. But this is right now a way too big change I cannot do right now.

Aucun commentaire:

Enregistrer un commentaire