0

Let's suppose that I want to create an Xcode static library. I use the Xcode provided template for this kind of project "Cocoa Touch Static Library", i want this library in a separate project because:

  • I want be able to keep this project under git version control
  • I want to be able to import this static library under other project as a git submodule

Now let's suppose that this library depend on third-part library such as ASIHTTPRequest. Maybe in my main project (the one that import my static library) i will also depend on the same library. What's the best way to handle this multi-dependecy?

PLUS: Now suppose that i want to create a second static library (this one is more specific for some kind of task and i don't want to mix this code with the code of the previous mentioned static library) but this second static library depend on the after mentioned static library. Again what the best way to handle this

Luca Bernardi
  • 4,191
  • 2
  • 31
  • 39

1 Answers1

0

Your question is not super clear, Luca, but let me see if I can help you out a bit.

In one of my own projects, I have a number of embedded (or "sub") projects which get built as libraries included in the main project. So if one file in the sub project changes, both the sub project and the main project pick up the changes.

With Xcode 3, it was a snap to simply drag and import one project into another project and if you have Xcode 3 installed, I highly recommend using Xcode 3 to embed one project into another.

Xcode 4 does handle projects already embedded within another project (like what you might have created using Xcode 3), but the ability to actually do the work on it's own is not fully implemented or baked yet (in other words: it does not work well or at all). Here's another question somebody else asked with more information that might help you.

Also, I noticed this other related question.

Does this information help you out?

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Michael, Thanks for your reply. I know how to include a subproject so the informations you provide me are redundant. In what my question is not clear? My focus in mainly in which is the best practice for example if i include ASIHTTPRequest in my static library how can i check in my main project to not import again ASIHTTPRequest if i've just included it with my static library? – Luca Bernardi Feb 16 '12 at 13:33
  • You're safe doing multiple `#import` calls because the Objective C compiler makes sure it's only included once. [Here's a related question that explains this better](http://stackoverflow.com/questions/439662/what-is-the-difference-between-import-and-include-in-objective-c). – Michael Dautermann Feb 16 '12 at 13:39
  • Thank again. I know that is safe to use #import multiple time. Maybe i'm not explain my point, my point is more about how to organize the code. – Luca Bernardi Feb 16 '12 at 13:44