Swift-MVC
Gabriel Massana
163

I haven’t adopted any of the architectures that you describe in full. Probably my code resembles more the MVP than anything else but it really depends on the circumstances.

Does this pattern work well for testability or do you find yourself explicitly calling methods from the view controllers lifecycle in your Unit Tests?

One of the problems that I see, it may not be major, is that I don’t think this pattern encourages reusability. I wonder if the code on WeightViewController+Logic could be reused somewhere else or it is actually coupled to the specifics of the view controller.

Where would you put the generic business logic in this structure? Things like fetching data from the wire, storing it locally, etc. which clearly independent of the view controller.

Finally and this is subjective, but to me adding more code to a view contoller even if it is by extensions written on separate files, it still feels like it is contributing towards the Massive View Controller problem.

Like what you read? Give Juanjo Ramos a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.