You’ve just built another screen in your iOS app, and after your final push, you take one last look at the view controller you implemented. Yikes! It’s over 500 lines long, and it’s only in its infancy – it’s guaranteed to get even bigger as you add new features and functionality to this screen.
You know that MVC doesn’t stand for Massive View Controller… but what can you do?
All that code needs to be there, right? The network requests, table view delegate methods, view layout, and UI interaction all need to happen in the view controller, right? And there’s nothing you can do about it… is there?
What if you could keep all of your view controllers light and small?
And on top of that, what if you could actually write unit tests for your code?
- You’d significantly improve your app’s architecture, making it easier to maintain, refactor, and add new features.
- You’d have reusable code you can actually reuse.
- You could easily write unit tests that give you confidence in your code – and the confidence you need to refactor.
- You could say goodbye once and for all to the mountains of spaghetti code that always seem to pile up in your view controllers.
You can build smaller view controllers that are easier to maintain – you just need to use the Model View ViewModel (MVVM) pattern. And as a bonus, moving to an MVVM architecture will make automated testing and code reuse so much easier.
Say goodbye to Massive View Controllers once and for all.
Learn to implement MVVM in Swift with the Beginning Swift video course and start eliminating your Massive View Controllers today by applying the lessons in the course.