简体   繁体   中英

Xcode folder structure for adding a library

I'm creating an iPhone app in X-Code. I have downloaded the ASIHTTPRequest library to make requests to my web server. What should my folder structure look like after adding this library? If I were to take a wild guess on the general best practice, it should either be like this:

  • Classes
    • ASIHTTPRequest
      • ASHTTPRequestClass1.h
      • ASHTTPRequestClass1.m
      • ASHTTPRequestClass2.h
      • ASHTTPRequestClass2.m
      • ...
  • Other Sources
  • Resources
  • Frameworks
  • Products

OR

  • Classes
  • Other Sources
  • Resources
  • Frameworks
    • ASIHTTPRequest
      • ASHTTPRequestClass1.h
      • ASHTTPRequestClass1.m
      • ASHTTPRequestClass2.h
      • ASHTTPRequestClass2.m
      • ...
  • Products

可以安全地添加到类文件夹中,并在包含标头的代码中使用。

Personally I only put compiled products in my Frameworks folder. Uncompiled classes part of a "library" I usually put into a Utility folder in the root of my project. I should add that recently I've been using more and more code from sources like github for use in my projects. I like to put these kinds of projects in the root of my Development folder, eg like this:

in the folder 'Development':
/project_1 /* my project that makes use of json and egocache */
/project_2 /* my project that makes use of json and three20 */
/project_3 /* my project that makes use of three20 and egocache */
/...
/json-lib-github
/egocache-lib-github
/three20-lib-github 
etc...

In my projects that make use of the libraries I create references to these projects, again the references are created inside the Utility folder in the root of my current project. This way all my projects can share the github code and I can easily update these libraries for all my projects at once.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM