Should xcworkspace be in gitignore
If you have/or plan to have several projects in the workspace (for example sub projects of your project) then you should not add it to .gitignore
.
Cocoa pods just adds its own project to the workspace if a workspace exists when you do a pod install
.
In general it is safer to include the workspace file in the git commit, even if you exclude pods.
You will have to do a pod install
anyway to compile your project so even if you commit a workspace file that already has the cocoa pod project added it wont cause any issues.
In short yes it should be commited.
I have my xcworkspace
file checked in to my repo. If you don't use a workspace it probably isn't needed but as I use Cocoapods this creates a xcworkspace
with the original project and the pods project inside of it.
Use a workspace is the correct way on handling multiple project sets/dependencies.
If you're using Cocoapods, I actually find that the answer depends on a few things.
- If you just want the project to be compilable and runable "out of the box", then go ahead and check everything in; xcworkspace and all pods.
- If there is a pod that you need to modify for some reason and you want to include that change with your project, then check everything in. For instance, I've found bugs that haven't been fixed for one reason or another and it was easier to just fix them myself and check in the pod along with my project rather than wait for the updated pod or integrating the library manually (which is essentially the same result as checking the pod in anyways). Alternatively, fork the repo, push your changes to it, and point your pod to your fork.
- If you have no issues with any of the pods and you've verified that everything works with the versions of the pods you've specified, then you don't have to check in the xcworkspace file or pods. Of course, you'll have to run
pod install
in this case.
There's no hard and fast rule on what to do here. Sometimes it's worth the extra overhead to just check everything in, and sometimes it's not necessary. It depends on what's most convenient for you.