"I don’t feel in control of my project’s architecture."
"MVC simply doesn’t cut it. There must be a better solution."
Firing up Xcode and starting a new project is a great feeling. The first few days or weeks don’t feel like work. Everything goes according to plan.
But as the code base of your project grows, it becomes harder and harder to manage the project. The view controllers of your project start to put on weight … a lot of weight. They become more than view controllers. They take on responsibilities they didn’t sign up for. Don’t they?
Yet you’ve done everything right. You’ve stuck to the rules of the Model-View-Controller pattern. Why have you coded yourself in a corner? And why is it frustrating or downright scary to add features or refactor existing functionality?
If your project is suffering from Massive View Controller syndrome, then the Model-View-ViewModel pattern is the cure to your problem. The Model-View-ViewModel pattern has been around for many, many years, but it only recently gained substantial traction in the Swift and Cocoa community.
MVVM extends MVC by resolving common issues. The result is a robust application architecture with lean view controllers, improved testability, and a better separation of concerns. How does that sound?
In Mastering MVVM With Swift, we refactor an existing application built with MVC to use MVVM instead. The results are dramatic and the MVVM pattern is surprisingly easy to adopt in your projects.
You learn the differences between Model-View-Controller and Model-View-ViewModel, highlighting the benefits Model-View-ViewModel has over Model-View-Controller.
After a short introduction, we take an application built with Model-View-Controller and refactor it to use Model-View-ViewModel instead. Along the way, you learn about the anatomy of view models, how to create them, and how to test them.
We add protocols and protocol-oriented programming to the mix to further simplify the view controllers in the project.
MVVM truly shines with bindings. I first show you how you can roll your own solution. Later in the series, we look at reactive programming (RxSwift and RxCocoa) to take MVVM to the next level.
At the end of this series, you will have the knowledge and, more importantly, the hands-on experience to apply Model-View-ViewModel in your projects.
In this series, you learn everything you need to know to integrate MVVM in a new or an existing Swift project. We focus on the key aspects of the pattern and refactor an application that takes advantage of the core features of MVVM. We use the latest and greatest to build an application, which means we use Xcode 11 and Swift 5.
"It suddenly hit me that taking my career serious meant leaving my comfort zone. It turned out that MVC was my comfort zone."
Are the view controllers of your projects suffering from Massive View Controller syndrome? You’ve 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 they’re 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’ve 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. Does that sound familiar?
Because Apple’s frameworks are impregnated with the Model-View-Controller pattern we think it’s the right or only tool for the job. Don’t make that mistake. There’s nothing wrong with the Model-View-Controller pattern, but there are better alternatives, especially if you’re using Swift.
It’s time to put the view controllers of your project on a diet. I’m sure you’ve heard about the Model-View-ViewModel pattern. It’s 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. It’s a proven strategy for robust, scalable applications.
I bet you’ve 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’re still using MVC, then chances are that the answer is “the view controller”. Stop. Give MVVM a shot. You can thank me later.
MVVM 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.
The Model-View-ViewModel pattern isn’t rocket science. In this series, you learn the ins and outs of the Model-View-ViewModel pattern by refactoring an application built with MVC.
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 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 this series uses the latest Swift syntax?
This series doesn’t just teach you MVVM. It goes well beyond that. It shows you how modern mobile applications are architected and the MVVM pattern is a key ingredient.
"Even though I was already familiar with MVVM, Bart's course showed me a different perspective on MVVM by refactoring a complete application built with MVC. He illustrates how MVVM can improve a project's architecture and testability, and how reactive programming fits in."
Damian Esteban, Chief Technology Officer, betterPT
"Cocoacasts Plus is for me. The content is awesome and the commitment is great. I'm a Mobile Developer Advocate at AWS and my focus is on iOS. I use your best practices when providing samples, tutorials, or writing snippets of code for a blog."
Dennis Hills, Mobile Developer Advocate, Amazon
"It has been a pleasure to work with Bart. I've found him to be diligent, conscientious, and reliable. His own competence has made my job much easier. And his skill as an iOS developer continues to amaze me."
Adam Brown, Code & Mobile Development, Envato
"Bart helped me understand and implement MVVM in an existing project that suffered from Massive View Controller syndrome. We analyzed the problem, developed a strategy, and refactored the view controller, using MVVM and reactive programming. The result is a lean view controller and a focused view model that's easy to test."
Win Raguini, Lead iOS Developer, MasterClass
"This is one of the finest Swift material available on the internet. Thank you."
"A big thank you. This has been the single most effective course I've taken about iOS. I put it into practice right away and our App Store app, and its testing, has benefited greatly."
Jake Young, Chief Information Officer, ACP Decisions
"This is by far the best explanation of Core Data I have read. After working on my first Core Data project for the last three days, I actually understand what you are saying here."
Gravity Zero Design
"Wow, I really love these tutorials. Great job. You are very good at explaining things from the ground up in a way that is both fast (not boring) and yet comprehensive."
You already have experience building applications using Swift and Xcode, but you’re not happy or fed up with the MVC pattern.
You know it’s time to step up your game. It’s time to move beyond the Model-View-Controller pattern. You’ve outgrown MVC and are ready for MVVM.
Your goal is to build robust, scalable applications for Apple’s platforms using Swift.
You don’t want to plough through countless tutorials—most of which are out of date—that only show you partial implementations.
My name is Bart Jacobs and I’m the founder of Code Foundry, a mobile development company. I’ve been teaching since 2004 and I currently focus primarily on teaching Swift developers how to create robust, scalable applications for Apple’s platforms using Swift and the Cocoa frameworks.
I’m crazy about film music and I have a soft spot for tea and coffee. I’m currently weaned off coffee, but we’ll see how long that lasts.
|Is Model-View-Controller Dead|
|How Does Model-View-ViewModel Work|
|What Is Wrong With Cloudy|
|A Quick Recap|
|Time to Create a View Model|
|Put the View Model to Work|
|Rinse and Repeat|
|Using MVVM In the Settings View|
|Adding Protocols to the Mix|
|Making Table View Cells Autoconfigurable|
|Supercharging View Models With Protocols|
|Ready, Set, Test|
|Writing Unit Tests for View Models|
|Using Stubs for Better Tests|
|A Few More Tests|
|Taking MVVM to the Next Level With Bindings|
|What Are the Options|
|Integrating RxSwift and RxCocoa|
|Refactoring the View Model|
|Refactoring the View Controller|
|Protocol Oriented Programming and Dependency Injection|
|Testing and Mocking|
$19 / month
Pay Once a Month
30 Day Money Back Guarantee
$8.25 / month (billed annually)
Pay Once a Year and Save $129
30 Day Money Back Guarantee
Access to All Books