79

I am doing command line xcodebuild using a shell script. My problem is if I open and close the xx.xcodeproj file once and then use that command it works well.

Somehow if I get deep into the file changes, this project.xcworkspace is the only file that has changed. Is this file valid and should I check it into version control? Will this cause any issues?

I've heard that it's as important as .pbxproj: is this true?

I couldn't find any valid documentation which talks about the roles and responsibilities of various files in the xcode project files. Please provide links which help me to understand that.

Matt Fenwick
  • 48,199
  • 22
  • 128
  • 192
thndrkiss
  • 4,515
  • 8
  • 57
  • 96

3 Answers3

118

project.xcworkspace is a directory of files describing the workspace or projects. Although some of the answers here indicate it is unnecessary and should be ignored for source control, I don't agree, but it's going to be highly dependent upon how you use your environment. Generally, the contents of the project.xcworkspace directory contains the contents.xcworkspacedata file, which lists the projects that are included as top-level entities in your project, an xcuserdata directory, which contains each user's settings (should be ignored for source code controL), and xcshareddata, which is data shared by users who share a project, and should be under source control.

In environments where you don't share workspaces, or where you use simple workspaces, you can ignore these as well, however in environments where you put related projects in the same workspace and share that configuration, you may well want to keep these.

gaige
  • 17,263
  • 6
  • 57
  • 68
  • 13
    The project.xcworkspace file gets created if you use Cocoa Pods (pod install). It creates a pods workspace and you'll need to open the project.xcworkspace file instead of the project file moving forward if you want what you just installed via Pods. – LevinsonTechnologies Aug 05 '15 at 16:25
  • 15
    @LevinsonTechnologies The OP is referring to a subfolder _within_ the project's `Foobar.xcodeproj` top-level folder. That subfolder is _literally_ named `project.xcworkspace`. The thing that CocoaPods creates and that you are referring to is another _top-level_ folder named `Foobar.xcworkspace` which exists on the same level as the `Foobar.xcodeproj`. Don't confuse the two things! My guess is that Xcode always needs a workspace, and that the subfolder is some sort of "hidden" workspace that Xcode creates and maintains behind the scenes for you as long as you only work with the .xcodeproj. – herzbube Jun 24 '16 at 16:45
6

I don't think project.xcworkspace under xx.xcodeproj is important enough to be added to SCM because it can be automatically recreated by Xcode if you delete it. Actually it has nothing to do with Cocoapods.

If you create a workspace named x.xcworkspace, create a project named y.xcodeproj and add the project to x.xcworkspace at the same time; then you will find that there is no project.xcworkspace created under y.xcodeproj directory.

However, if you open y.xcodeproj with Xcode, project.xcworkspace is automatically created under y.xcodeproj folder by Xcode.

DawnSong
  • 4,752
  • 2
  • 38
  • 38
-1

This is a help in case you have a proyect of an app and your ideas,implementations and other things you added in that place

  • This answer doesn't really help or add-up to the previous one. Feel free to revisit it and dive deeper into the subject or its technicality. – Ben Aug 19 '20 at 03:32