Sunday, June 2, 2013

Add the shared library into the workspace

As you are working on more and more project, you might wonder how to share the codes among these projects without have to copy the same class files. This can be done by creating a project with all your shared codes. Then, follow the steps below to add the shared project into the new project that you are working on.

Step 1: make sure that you have created a workspace in your project. This can be done by selecting Save As Workspace from File menu.

Step 2: right click on the project that you are working on and choose 'Add Files to "xxx"'. You will have to choose the "xxx.xcodeproj" file from the Finder.


Step 3: open up the project settings and goto Summary tab. Click on the "+" button as shown below.


Step 4: Choose your shared library from the Workspace.


Step 5: goto Buil Settings tab and search for "linker". Key in "-ObjC".


Step 6: You may continue to add new project references. Once you have done it, you might have to regroup the references into Frameworks. This step is optional.


Step 7: Finally, to use the classes that you have done in the shared project, you have to add the source code reference path. Goto Build Settings, search "search" text. Then, key in the shared project source code path in the "User Header Search Paths".


No comments:

Post a Comment