How to run a specific project when you have multiple projects in xcode? - xcode

If you have a xcode project like restkit that has the core code for restkit + examples that have their own project, how do you run a specific project?
https://github.com/RestKit/RestKit/
If you look at the /Example's folder, you will see they have a few of them and each have their own project file.

You can use multiple targate in xcode.
A target specifies a product to build and contains the instructions
for building the product from a set of files in a project or
workspace. A target defines a single product; it organizes the inputs
into the build system—the source files and instructions for processing
those source files—required to build that product. Projects can
contain one or more targets, each of which produces one product.

Related

xcode 11, sharing a group of utility classes between different projects

I have a set of utility classes that I reuse in several xcode projects.
I want to include the utility classes in every project.
I currently do this by adding inside every xcode project a group and dropping there the files from the file system.
This way, they are included in the compilation.
But every time I do filename changes in the utility classes (e.g. add/rename/delete a file) I have to go through all the projects and reflect the change there.
Some notes:
The projects are irrelevant, i.e. not different products from a suite of products. So I cannot use an all products project and do the separation at the targets level for each of the products.
When I do changes in a utility class from one of the projects, the changes should be reflected in all other projects.
the utility classes are already on a repo of their own.
I prefer not to make copies of the files of the utility classes inside every project
I do not want to do the trip of creating a framework that will then be used by every project. Not all classes are used by every project. I just want to have them compiled as a source files.
As a test, I made a project containing the utility classes and no target, added the project as a child of one of my projects.
I.e. instead of having the yellow folder icon of the file group, I have a project icon containing the files.
The compilation does not seem to pick these files.
Maybe a cmakelists.txt file could serve this purpose? I.e. give to xcode an additional list of files to include in the compilation?
For the Windows's edition of my projects, I use Microsoft's Visual Studio "shared items" project which accomplishes exactly all these requirements.
What is your advice for xcode?
Thanks!
Similar to:
Sharing classes between projects in xcode/objective-c
Sharing classes between Xcode projects

Setting up sample project for other developers Xcode

So I am trying to set up a sample project that includes all of the search headers for distributing to other developers.
My plan is to have the folder structure something like this when the developer unzips the project:
/SDKandSample
/SDKandSample/SDK
/SDKandSample/SampleProject
How can I have xcode link to the correct SDK folder regardless of where the folder is stored?
You can set up a workspace that includes two projects. One project is your framework / library. And the other is your example project. The example project will link to your framework / library. Check out this project for an example.
If you're wondering how to create file paths in build settings that reference the project root:
$(SRCROOT)/MyDirectory/MyFile.ext

Cocoapods generating separate additional workspace project file?

Somewhat of an intrigue to me is how Xcode creates a new workspace project file after you make your project 'cocoapods aware' to install a pod to your current project. So the older project file has blue icon, the new one has the same name but with .workspace appended and has white icon.
I am wondering why the need to have this separate file and also if the older one without the pod is still needed by this new file?
A workspace is an Xcode document that groups projects and other
documents so you can work on them together. A workspace can contain
any number of Xcode projects, plus any other files you want to
include. In addition to organizing all the files in each Xcode
project, a workspace provides implicit and explicit relationships
among the included projects and their targets.
Since Cocoapods is a library manager and install/integrate all the libraries you want in your project. After installing pods, you have noticed that it creates a workspace that contain your project + Pods Project (this one contain all the libraries that you have installed.) as your project has dependencies on those libraries and this is how CocoaPods works. You can open your project with older name '.xcodeproject' but you won't be able to access the libraries as it does not contain pod.

xcode target dependencies between two projects

I have a problem with setting dependencies in XCode 4 between separate projects. Currently, I have two projects in the same workspace. The first project have a Framework amongst it's products. I would like to use this framework in the second project, as a dependency for Bundle target.
First project build successfully. However, the second one claims that it cannot access headers from the framework, although it exists in there. I added the framework to Build Phases -> Link Binary With Libraries section of my target, but this does not help. I was looking for an answer, but all I found were suggestions to add library on the Summary page. Unfortunately, in opposite to Application targets, Bundle target does not have this pane. Is there any other place where should I add the framework?
This answer describes the current procedure for adding a library dependency, including headers: https://stackoverflow.com/a/9726445/382938

How to import JSON framework?

I've downloaded the JSON framework DMG from http://code.google.com/p/json-framework/downloads/list. I followed Option 3 here: http://code.google.com/p/json-framework/wiki/InstallationInstructions. For the copy files build phase, I set path to ~/Library/Frameworks/JSON.framework. Buid failed. I then tried setting it to my project root. Build failed.
I keep getting this error:
<JSON/JSON.h>: No such file or directory
Any suggestions?
There's no need to put the framework in Library, at least under Xcode 3.1.3. Here's what you do:
Put the JSON framework source tree in your source tree.
Add the framework project to your project.
Get Info on your target, click + under the Direct Dependencies list, and choose the framework target from the framework project.
Right-click on your target in the group tree and choose “New Build Phase▶ Copy Files”. In the window that results, choose Frameworks as the destination.
Add the framework target (which will transmogrify into its build product) to the Copy Files phase.
Add the framework target (which will transmogrify) to your target's Link with Libraries phase.

Resources