Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of Xcode 4's workspaces?

Tags:

xcode

xcode4

I don't quite understand the utility of Xcode 4's workspaces. What are they used for, and how do they aid with development in Xcode?

like image 282
Pier-Olivier Thibault Avatar asked Nov 05 '22 14:11

Pier-Olivier Thibault


1 Answers

E.g. you have a library, that you use in two applications. You will most likely have an own project for this library, correct? Now, you are free to treat this library as an independent project with versioning and regularly do releases; but this can be very cumbersome, if you need to change the library code pretty often and all these changes are directly caused by changes to your two applications using that library. Instead you can create two projects, one for each applications and then two workspaces, one consisting out of the library project and app 1, the other one out of the library project and app 2. Opening a workspace always opens both relevant projects, workspace build settings automatically apply to both of them, they both build to the same build directory (which is actually chosen by Xcode automatically, but it is chosen by workspace, not by project) and when you do global searches, search for symbols, etc. Xcode will always do so in both projects. Further if you change build settings to the library project, because you have to, the changes are also correctly set when you open up the other workspace, which is an advantage to directly importing the library files to two different projects. And now think of 50 libraries, 20 apps and each of them uses various of those 50 libraries.

This may not be the idea Apple had in mind, it may not be the perfect use case for workspaces and other people may have better ideas, but this is one use case I can think of.

like image 199
Mecki Avatar answered Nov 14 '22 23:11

Mecki