Mastering MVVM with Swift: Updated for Xcode 9 and Swift 4
Author | : Bart Bart Jacobs |
Publisher | : |
Total Pages | : 175 |
Release | : 2017-07-17 |
ISBN-10 | : 1549935984 |
ISBN-13 | : 9781549935985 |
Rating | : 4/5 (84 Downloads) |
Download or read book Mastering MVVM with Swift: Updated for Xcode 9 and Swift 4 written by Bart Bart Jacobs and published by . This book was released on 2017-07-17 with total page 175 pages. Available in PDF, EPUB and Kindle. Book excerpt: "I don't feel in control of my project's architecture." - You"MVC simply doesn't cut it. There must be a better solution." - Yours TrulyDespite its widespread, the Model-View-Controller pattern just doesn't cut it for most Swift projects. Take control of your Swift projects with the Model-View-ViewModel pattern.Massive View Controller SyndromeFiring 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?It's Time to Cure MVCIf 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 traction in the 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?Take Control of Your Project With MVVMIn 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 own 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.Last but not least, we add protocols and protocol-oriented programming to the mix to further simplify the view controllers in the project.At the end of this course, you have the knowledge and, more importantly, the hands-on experience to apply Model-View-ViewModel in your own projects.Ready for Xcode 9 and Swift 4In Mastering MVVM With Swift, 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 9 and Swift 4.Battling Massive View Controller SyndromeAre 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 this sound familiar?It's Not You. It's MVC.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 the same mistake. There's nothing wrong with the Model-View-Controller pattern, but there are better alternatives, especially if you're using Swift.