Xcode creates sub-engineering and engineering dependencies

https://www.jianshu.com/p/f2bc7d155a86

Read 7858

If the video address is not detailed in the article, click to see the operation video

Project requirements: code extraction, business logic and data The processing needs to be highly isolated and modular, and the model layer and network layer need to be isolated. Therefore, consider building a public project. Every time you build a new project, you just need to rely on this project. After the code is modularized, we can continuously optimize and integrate each module to facilitate the realization of some more complex requirements and structural designs.
 Idea design: ①MonkeyApp, used to store public libraries. ②MonkeyAppDemo is used to write demos and examples.
 Specific steps:
 1. Create a MonkeyApp project. Note that the dependent project here is Cocoa Static Library. 
Share a picture psb.png

2, create a MonkeyAppDemo project. Right-click on MonkeyAppDemo and add File, select MonkeyApp.xcodeproj, and establish a dependency.

share picture 1__# [email protected]%!#__psb.png

3. Import related classes in MonkeyAppDemo will have errors that cannot be found and compilation errors will occur. The following operations are required:

/div>

share picture 2__# [email protected]%!#__psb.png

4, There is still an error after compiling. Or the compilation still shows that the relevant files cannot be found. At this time, it can be judged that the result of the compilation is not correctly dependent. Perform the following steps; add the dependency of the target to ensure that the MonkeyAppDemo is compiled first Compile MonkeyApp. Select MonkeyAppDemo Target, then select its Build phases option, and add MonkeyApp target.

5: If you need to introduce MonkeyApp For the image resources in, you need to check the copy file option.6: When there is a category, using the category will cause Crash. The solution is to add and compile in the Sample Command
​ < /div>

share picture 4__# [emailprotected]%!#__psb.png < /div>

7: The final effect, so that the model layer and network layer can be extracted.

Share a picture 5__# [email protected]%!#__psb.png

Read 7858

Read 7858

share picture psb.png

Share picture
Share a picture 1__# [emailprotected]% !#__psb.png

Share pictures

< img alt="share image" src="/wp-content/uploads/images/mobile/ios/1626792549891.png

2__# [emailprotected] %!#__psb.png

Share picture
share picture 4__# [email protected]%!#__psb.png