Does Your Project Suffer From Massive View Controller Syndrome?
Are the view controllers of your projects suffering from Massive View Controller syndrome? You have carefully crafted the architecture of your application using the Model-View-Controller pattern and, yet, the view controllers of your project are ready to burst and impossible to test.
Adding a feature forces you to wade through hundreds of lines of code. You hope you don’t break anything while you carefully add a few lines of code. Don’t get me wrong. Your code isn’t bad. But there’s just so much of it. You have applied the Model-View-Controller pattern like you were told to and you still end up with an architecture you aren’t quite happy with.
It’s Not You. It’s MVC.
Because Apple’s frameworks are impregnated with the Model-View-Controller pattern we think it is the right or only tool for the job. Don’t make the same mistake. There is nothing wrong with the Model-View-Controller pattern, but there are better alternatives, especially if you are using Swift.
Put Your View Controllers On a Diet
It is time to put the view controllers of your project on a diet with the Model-View-ViewModel pattern. I’m sure you’ve heard about the Model-View-ViewModel pattern. It is the new cool kid in town. But the thing is that it isn’t a kid. MVVM has been around for many, many years and has earned its stripes.
Where Should This Code Go?
I bet you have asked yourself many times “Where should I put this piece of code?” Every developer asks himself/herself this question, multiple times a day. If you are still using MVC, then chances are that the answer is “the view controller”. Stop. Give MVVM a shot. You can thank me later.
The Model-View-ViewModel pattern is a perfect fit for Cocoa applications powered by Swift. The view model unburdens the view controller from the ungrateful task of data manipulation and transformation. The result is a focused, testable view model and a skinny, lightweight view controller.
Mastering Model-View-ViewModel With Swift 3
The Model-View-ViewModel pattern isn’t rocket science. In Mastering Model-View-ViewModel With Swift 3, you learn the ins and outs of the Model-View-ViewModel pattern by refactoring an application built with the Model-View-Controller pattern.
You learn how to create, use, and test view models. You use protocol-oriented programming to further simplify the view controllers of the project. You also learn how to easily adopt the Model-View-ViewModel pattern in your own projects.
Stop wasting time trying to fit your application’s architecture in the Model-View-Controller pattern if you have an alternative with a proven track record. Did I mention that Mastering Model-View-ViewModel With Swift 3 uses the latest Swift syntax?Show Course Details