Architectural patterns

For iOS developers, it’s not just about implementing features. Stepping into the threshold of 2-3 years, more attention should be paid to the structural level of code and project, so it is a necessary skill to master several current mainstream architecture modes. Are you still frustrated by the use of MVC in your projects instead of experimenting with new architectural patterns? Or want to try but don’t know how?

There are several existing architectural patterns

  • MVC
  • MVP
  • MVVM

All three design patterns are variations of MV(X), which categorizes the entities in our application into the following three categories:

  • Models: Responsible for primary data and data operations
  • View: Responsible for UI display of the interface
  • Controller/ViewModel/Presenter: intermediate, used to coordinate the Model and the View.

But how do we actually apply that in real code? The main problem with MVC is that the Controller does too much work, which is what we call a Massive Controller, but there are ways to decouple it to make it easier to reuse and test.

In the CASE of the MVP, the main goal is to decouple the View state through protocol oriented programming. How do we program for protocols in iOS, what are the techniques, and how do we actually apply them in development? That’s what we should be focusing on.

MVVM is the newest architecture, originally proposed by Microsoft. In MVVM, we use the ViewModel to coordinate the relationship between the View and the Model, and of course our Controller is also referred to as a View. The challenge here is how does the ViewModel reconcile these two things? Glue code? RAC?

These questions will be shared live in an iOS technology exchange group. Click the link below to join the group chat directly! It also provides a place to blow water and discuss technical issues!

Click the link to join the group chat [iOS development Technology Exchange] : jq.qq.com/?_wv=1027&k…