Xcode folder structure for adding a library
I'm creating an iPhone app in X-Code. I have downloaded the ASIHTTPRequest li开发者_JAVA技巧brary 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
- ...
- ASIHTTPRequest
- Other Sources
- Resources
- Frameworks
- Products
OR
- Classes
- Other Sources
- Resources
- Frameworks
- ASIHTTPRequest
- ASHTTPRequestClass1.h
- ASHTTPRequestClass1.m
- ASHTTPRequestClass2.h
- ASHTTPRequestClass2.m
- ...
- ASIHTTPRequest
- 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, e.g. 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.
It is safe to add in your classes folder and use in your code with including header.
精彩评论