5 Heuristics for "I have a complicated nested view controller setup. How do I handle passing data?"


That's a recent question from the comments put in my own words. A view model that encapsulates the display state sounds promising at first. But when you don't have a simple view that displays one thing, how do you model that in code? How do you model a sequence of view controllers, for example a more complex checkout process?

There are a few heuristics I adhere to for as long as humanly possible (i.e. there are cases where it just doesn't work, but I try to neglect this for as long as I can):

These heuristics will not magically cure your problems. But these imperatives have helped me make a decision that didn't target short-term benefits (a.k.a. "quick fix") and they may help you, too.

You might also like to read about the SOLID object-oriented design principles to give this another angle.

Browse the blog archive