iOS Common MVC Schema Project framework Mobileproject

Source: Internet
Author: User

recent projects are not in a hurry, decided to integrate some common, common content in a project framework, intended for the new project can be quickly set up, in fact, after several projects, there are always some duplication of the creation of work, you can use the content of this project directly to develop, using the MVC layered mode, This article will focus on the division of hierarchies and some of the third-party features that have been integrated; Of course, the source code for this project has been uploaded to GitHub (address:https://github.com/wujunyang/MobileProject above, of course, if you have to help remember to give a star, if you have time can also be perfect together, or have any problems can also be timely message;

This project is created on the XCode7 above, if your Xcode version is under 7, you can delete the code in a few 7 of the features, you can run this program, the project using pods for some third-party plug-in management, pods knowledge is not the focus of this article, If you do not know that you can search on the web, the project uses two targets to differentiate between the product environment and the test environment, and then set different connection addresses when the network interacts, assuming that multiple versions of different regions are configured by different targets. Through the targets identification of some differences, the level of the project is now more commonly used, if you have a better opinion of the proposed, will be updated to the project, the framework of the project will be constantly updated with the integration of new content in;

A Overall Framework


Project Mobileproject is the main project, Pods is the project of automatic management of some third-party plug-ins, and the project is divided into main, Expand, Resource, Vender, Sdkfile, Mobileproject project. Six parts of supporting files;

One: Main (main): Mainly in the content file about MVC, the content of the child for each large function module; currently Mobileproject has been created by default, including logger (log), preview (preview), Home (home), public, Base (base class), login (login);

1.1.1 Preview is used to store some exercises of the function page, this project integrates some third plug-in instances or instance code will be placed inside;

1.1.2 Public is mainly to consider some of the possible features of each module will be included in the content can be placed here, in each large function module includes the following several, respectively, model, View, Controller, other; Here again the view level is split subview and cell; The Subview is intended to store some sub-views, while the cell is for storing some table rows, which can be created with different children based on each project;

1.1.3 base is used to store some extracted extracts or to share inheritable content;

II: Expand (extension): Mainly to store some commonly used helper classes and extension classes, this level is divided into const (constant), Macros (macro), tool (Tools), network (networks), category (classification), database (databases) six parts;

1.2.1 Which macros inside another two files Macros.h, ThirdMacros.h, the first is to store some items with commonly used macros, such as screen size, font, etc., and the second is intended to store some third-party SDK to use the key value, such as Friends League, Baidu map, etc.;

The 1.2.2 tool currently holds some of the extracted help management classes, such as Umenghelper (Friend Alliance Management), Lcationmanager (location management), Logger (logging), reachability (network status), etc.

1.2.3 Network is currently using the Ape Question Bank package afnetworking used ytknetwork source code, this project to make some fine-tuning, so that it applies to multiple targets in the project corresponding to different request addresses, To modify the API address in the Networkbaseurlconfig class, the network request address is now divided into the logical access prefix address, image loading address, the request address of the Upgrade app, login request address And then in the MVC layer of the API request and then according to Servercenter_type to distinguish between the loading is the prefix address; the login module in the project already has an instance code;

1.2.4 category for Git above ios-categories classification of content, more create another to store the usual to expand the classification, commonly used extension classes are mostly contained in the inside;

1.2.5 database is intended to store some of the initialization data used in the project, of course, contains various types of files can be stored here;

Three: Resource (resources) mainly in three parts of the content, including the global (global), image (picture resources), Plist (configuration) three parts; This section is also relatively single, global is used to store some of the project's global content, Contains the contents of the startup item Launchscreen.storyboard, the header reference prefixheader.pch, the language pack file.strings, the image is used to store the picture resource, can be divided into different xcassets files according to the function module Plist for storing plist files, mainly in this project will create a number of tags, and each tag will have its own plist file for management, so unified storage convenient management;

Four: Vender (third party) to store some of the possible modified third-party plug-ins and some self-packaged plug-ins; In this example, a few of the more commonly used third-party plug-ins, a brief introduction of several of them, Gvuserdefaults is the encapsulation of userdefaults, Simple can be used for access operations; Jdstatusbarnotification is the plugin for the effect in the status bar; Actionsheetpicker bottom Popup such as time selection, option plug-in Qbimagepickercontroller is a photo-selection plugin that supports multiple selections and can set up the maximum number of selected sheets, and several other plugins can be searched on the network by name, so it is easy to have corresponding examples and usage methods;

V: sdkfile (integration) is intended to store some third-party SDK files, of course, many of the more well-known SDK has pods to manage, which also saves us from the maintenance of the update of the trouble, if there is no way to pods, put the SDK here;

VI: Podfile The main is some of the more stable third-party plug-ins and references to the SDK, the benefits of pod use is not in this introduction, if the project has not been used to hurry;

Platform:ios,'7.0'pod'afnetworking','~>2.6.0'pod'Sdwebimage','~>3.7'pod'Jsonmodel','~> 1.0.1'pod'Masonry','~>0.6.1'pod'Fmdb/common','~>2.5'pod'Fmdb/sqlcipher','~>2.5'pod'Cocoalumberjack','~> 2.0.0-RC'pod'Baidumapkit'#百度地图SDKpod'Umenganalytics-no-idfa'#友盟统计无IDFA版SDKpod'GTSDK'#个推SDKpod'umengsocial','~> 4.3'#友盟社会化分享及第三方登录

B Integrated Content

Mobileproject has now integrated Baidu map positioning, friends of the league statistics, cocoalumberjack Log records, push the message push, friends of the Alliance to share, friends of the third party login content; In the future, we will integrate some of the more commonly used content; The above sections can be used as long as the key is replaced , a push will also use your certificate, the corresponding instance code is in the project, is also verified tested; The initialization code is in the Appdelegate; (QQ, Sina) Three kinds of third-party login function, (blog space sharing, Friends Circle, Sina Weibo share, QQ Weibo share, Friends) Five sharing functions, the corresponding code is placed in the project preview, but also to increase the Cocoalumberjack log records of the display and viewing page;

iOS Common MVC Schema Project framework Mobileproject

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.