0

I'm new to Objective-C development. I would like to create an app that will be available on OS X and iOS. Since the two apps will share the same basis I'm thinking about creating a library that will be used by the two apps to minimize the code duplication. The two apps will be closed source while the library will be open source.

Since I was aware about the iOS limitations on dynamic libraries I thought the best solution would be to create a single project with two targets : a framework and a static library, as shown in this article.

Once I've started some prototypes with the help of the article linked above, I've managed to find many solutions to link my library but some of them seems stupid and other ones are coming with issues.

Workspaces

This solution seems like the easiest one, I just have to drag&drop and link the app to the appropriate target listed in the workspace. However, I encountered an autocompletion lacking while trying to #import my library to the main code, the library wasn't suggested. Whatever, I tried to compile the app by writing by myself the #import line (which was reported as an error by Xcode) and it worked! After the compilation, Xcode was correctly suggesting me the library with the autocompletion... Is there an explanation for that?

Also, I have another question about that solution : if I compile the app in release mode, will it be linked to the library in release mode as well or I will need to specify the release mode for the app and for the library?

Compile before linking

Another solution would be to compile the library into the OS X framework and the iOS static library, copy those binaries inside there respective project and link them. But I could think only about disadvantages, is there something good with that option?

Directly linking the sources

Like AFNetworking I could directly link the sources without using the binaries generated by the library targets.

CocoaPods

I heard about this project but I can't figure if it could be useful for me or not?

Any help to choose the appropriate way would be appreciated.

1 Answer 1

-1

'CocoaPods' works well and simple, try import <>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.