A discussion on the component of IOS

Source: Internet
Author: User

1. Preparatory work

As the project is getting bigger and larger, there are more and more documents. Many times when the merge code is in conflict with the project file, it can be difficult to modify if the. xcodeproj file conflict is opened.

So think of the modular program, and then go online to find information

Mushroom Street Small (There are demo, the house after the look after a simple point)

Roughly the same format as the URL scheme://host/path?query

1. When you start, register the corresponding URL host for the corresponding module name

2. How to use the route call URL directly when needed

2.CTMediator Overview (no sub-projects are currently generated, so the project is replaced by a folder)

2.1 Divided into three parts

Shell Engineering: Entrance to the entire program

Main project: Lib Library (Network tools, album tools, File Services, routing)

Sub-project: module Engineering

2.2 Ctmediator Working principle

1. + (instancetype) sharedinstance;

Routing Singleton objects

2.-(ID) Performactionwithurl: (nsurl *) URL completion: (void (^) (nsdictionary *info)) completion;

After the call can return a controller object, the format of the incoming URL such as Hgl://message/chat?key=value (message: From the module name, chat: The specific controller to point to)

3.-(ID) Performtarget: (NSString *) targetName action: (NSString *) actionname params: (nsdictionary *) params;

This method is faster than Method 2, which allows developers to understand [self performtarget:@ "message" action:@ "chat" params:@{@ "key": @ "value"}] more quickly.

4. All modules must have a routed receiver (ie, ingress)

4.1 Receiver class name target_ module name (Target can also be replaced by the words you like the definition of the word and then tell the others, others are good to follow this standard)

4.2 Method name inside Receiver-(Uiviewcontroller *) action_xx: (nsdictionary *) param; (XX stands for a controller)

A discussion on the component of IOS

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.