3 ms·
> Since view controllers do everything in MVC apps Not even close. The model does everything in MVC apps. Views display the model and react to model changes.
by mpweiher 11y ago
> Since view controllers do everything in MVC apps
Not even close. The model does everything in MVC apps. Views display the model and react to model changes. Controllers pick up the slack, which shouldn't be very much.
Now in Model Widget Controller[1] the "view controllers" (something that doesn't even exist in actual MVC) have to do more work because the widgets are generic. Still, if you find your "view controller" doing "everything", you've pretty much missed the point of MVC. Completely.
[1] http://blog.metaobject.com/2015/04/model-widget-controller-mwc-aka-apple.html http://blog.metaobject.com/2015/04/model-widget-controller-m...
- fleitz 11y agoCouldn't agree more, if you regularly have 400 line classes you're doing it wrong.
- girvo 11y agoThe authors point, is that most people in the native app world are doing it wrong. And in my experience, he's right.
- TheOtherHobbes 11y agoSome of the specialised iOS/OS X view controllers - e.g. UIImagePickerController - probably have a lot more than 400 lines. Other classes, like NSLayoutManager, look a lot like most of a view controller. But they're not officially a subclass of UIViewController, because they don't link directly to a view - even though they could have been designed to. Apple makes a big deal of MVC, but I sometimes wonder if anyone knows what MVC really is - except possibly a design pattern for generating disagreements about MVC.