I'm learning swift3 by working on a project of my own and I was wondering if there was any rules/recommendations on minimizing the number of view Controllers or using more to minimize the activity happening in one view. Or is it really just preference?
For example, I can either segue into a new view or just have things disappear/appear - such as to fill information.
All I've seen so far is different approaches by people which makes me think it's preference.
To answer the technical part of the query: don't factor performance into your thinking. A view controller is a very light thing — it normally uses fairly minimal storage and its job is primarily to react to view events. So processing costs are usually on demand, rather than intrinsic. Anything that is timed should be gated on viewDidAppear
and viewDidDisappear
, also so as not to cost anything unless that controller's views are visible.
Therefore the question is structure, not performance. I have an opinion about that — particularly since view controller containment was introduced, view controllers should do a single layout with the neatest implementation possible, with combinations and segues being handled by a parent, whether one of the supplied options such as UINavigationController or one of your own design, or if only segues are of interest then implicitly by that mechanism — but StackOverflow isn't really the forum for opinions because other people definitely think differently.