Ios Project developing MVVM pattern from scratch (i)

Source: Internet
Author: User

1. Previous projects have been using MVC to develop iOS, found that iOS has a disadvantage, MVC, viewcontroller inside there is a lot of business logic, when constantly modified, will find just a painful process.

2. Before doing WPF, using the MVVM pattern, you can put business logic into VM mode, and VMS can handle business logic. I've done several iOS projects and I've thought about the MVVM pattern, but I haven't found it yet. Occasionally seeing an iOS project with an MVVM pattern on the Internet, I'll try to do this project from scratch, and the source will be open when done.

3.ok, this MVVM open source project is C-41, interested can go online search.

4. This project to be linked to some class library, iOS has a Cocopods project management tool, can be configured on its own, I have been configured.

5. Create a new project, make a podfile in the project directory, enter

target "MyTools" do

pod ' Reactivecocoa ',' 2.1.8 '

pod ' LIBEXTOBJC ',' 0.3 '

pod ' Reactiveviewmodel ',' 0.1.1 '

pod ' uicolor-utilities ',' 1.0.1 '


inhibit_all_warnings!


End


target "mytoolstests" do


pod ' specta ', ' ~> 0.2.1 '

pod ' expecta ', ' ~> 0.2.3 '

pod ' Ocmock ', ' ~> 2.2.1 '


inhibit_all_warnings!


End


6. Perform pod install and automatically download and join the project.

7. When the project runs, it will report an error, xctest/xctest.h file not found built in Xcode 6

8. Encountered this error, we can go online to check, I found the right answer in StackOverflow, spit trough, in the domestic site, sometimes very slow, suggest that we go to get a flip wall software, I now use ladder, configuration is super simple.

9.in order to fix the Cocoapod dependencies you need to add the following to framework_search_paths  in any pods target that requires xctest (e.g. Kiwi, specta, fbsnapshottestcase, etc). /span>

$ (platform_dir)/developer/library/frameworks

10. To the effect that in reporting the wrong class library, you need to add $ (platform_dir)/developer/library/frameworks this stuff. This is added in Buildsettings->search paths->framework Search Paths inside.

11. Run our project on this MVVM schema. Follow-up will start to do a project.


Ios Project developing MVVM pattern from scratch (i)

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.