IOSMVVM Architecture Design

Source: Internet
Author: User

Occasionally on the Internet to see a blog about the architecture of iOS, after reading it felt very inspired, so record it, in case forget, also share it for everyone to study together.

Due to my limited project experience and limited understanding of the architecture design, my personal understanding of MVVM is mostly borrowed from the previous MVC web framework-used by the thinkphp framework in school, and the SSH framework, which are MVC's architectural patterns. Today's MVVM is very similar to the traditional MVC, and it can be said to be a sibling, a family.

When it comes to architecture design and teamwork, this is important for app development. Even as a professional brick-and-tile, if you put it in the end of the brick where? Not only the code has the framework, the other things are framed, such as bridges and so on God horse ~ here will not pull out. A good project framework can improve team collaboration efficiency, but also can reduce the redundancy and coupling of code, reasonable division of labor and system architecture design is indispensable.

As far as team collaboration is not just with SVN or Git version control tools, for how to use SVN in iOS development, refer to the previous blog (iOS development version Control (SVN)). A team can work efficiently, I feel that communication is the most important, everyone in the team is more pleasant, and communication is not any obstacle (but there are always a few people in the team), communication in the team is the most important. As for how SVN is used, it's not a thing!

MVVM Interpretation:

The model layer is indispensable, we have to have something to act as a DTO (data transfer object), of course, with a dictionary is also possible, programming, to be flexible. The model layer is a relatively thin layer, if you learn Java's small partners, JavaBean should not be unfamiliar with it.

The ViewModel layer, the binder for the view and model layers, is an excellent place to put user input validation logic, view display logic, initiating network requests, and a variety of other code. To put it bluntly, the original Viewcontroller layer of business logic and page logic and so stripped out to the ViewModel layer.

The view layer is the Viewcontroller layer, and his task is to get the data from the ViewModel layer and display it.

The above for MVVM on the first simple to say, good understanding and application, but also to combat.

Below is an example of the MVVM schema pattern, the following is the first level of the project directory below, each layer of interaction is implemented in the form of block


Project Catalog Description:

  1. Request: The class that stores the network request under the folder, the following will give a specific implementation

  2. Config: is the project configuration file

  3. Resource: Is the project resource file, the following picture resources and storyboard file resources

  4. Tools are: Tool file classes, storing tool classes, such as data regex matching.

  5. Vender: Storage of third-party class libraries

  6. Model: That's not much to say.

  7. Viewcontroller: Store Viewcontroller class resource file, which is the view layer

  8. ViewModel: Store various business logic and network requests

at the end of the article, attach the demo github:Https://github.com/lizelu/MVVM

Give me some SVN commands.

(1), update Local Code command

    • SVN up update version

    • SVN Info View current version information

(2), the code of the submission

  • SVN info View current local version information

  • SVN up update to latest version information

  • SVN St View file status m-Modify D-delete A-add U-Update?-Unknown status-warning C-conflict

  • SVN add FileName: What if it appears? Generally is the problem when adding files, after the file svn add filename, the status of the file will be changed to a

  • SVN del fileName: if it appears! This is usually a warning when you delete a file. After executing the SVN del filename command, the file's status is changed to D

  • SVN ci-m "Reason for submission"


    Original http://www.cocoachina.com/ios/20150122/10987.html



IOSMVVM Architecture Design

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.