GitHub, CocoaPods, and XCode - xcode

I have an iOS project which uses a few CocoaPods that I have been regularly committing to a private GitHub repo. Because of the CocoaPods, I always launch it via its workspace.
For the first time ever I attempted to work on the project on a different computer. When I opened XCode and attempted to pull the repo, I realized that the workspace is not in the repo. Only the project itself is there.
Does that mean I did something wrong when I initially created the project repository or does it mean that you simply cannot use multiple computers with GitHub to work on a project that requires CocoaPods?

Just run pod install on the other computer and it will download the dependencies from your Podfile.lock (or Podfile if no lock is present) and generate the workspace.
Another option is to add your Pods directory, along with your xcworkspace and Podfile.lock, to version control. That way your project will be always ready after cloning and your dependencies will be synced in your repository. If those items do not show up on Xcode's git interface, use the git from your Terminal or other app.

The use case you describe is quite common and works fine. You must have forgotten to add the workspace to the repo, maybe it’s in your .gitignores?

Related

Is it possible to include SPM checkouts in Git?

It's possible to store Checkout and Build directories when using CocoaPods and Carthage.
Is this possible using Xcode 11's SPM?
Or, if I could modify the location SPM uses for Checkouts, then I think this could work by setting this directory to somewhere in the workspace's directory structure.
(I'm in the camp that prefers to keep all assets required to build projects in the same Git repo as the project itself. Don't hate me :) )
You can't do this.
See my previous response to this question here.

How to convert Xcode project into workspace and avoid git merge conflicts

Currently I am working on a team project with Xcode that is stored in Foo.xcodeproj. We all work on our own branches and do git pull requests for merging into the common dev branch. I am at a point where I want to use CocoaPods and once I do a pod install then the workspace Foo.xcworkspace will be created. The CocoaPod docs say:
Make sure to always open the Xcode workspace instead of
the project file when building your project
On my branch I will have a workspace file whereas everyone else will be still working directly with the project file. I am trying to be preemptive and avoid difficult git merge conflicts. Will it matter if my teammates are still opening the project file or are we going to have merge conflict hell?
Being a one team you all should work in one either in Project or Workspace, are you the only one using cocoapods no one else in Team wants to get the functionalities available through Pods.
If you are the only one continuing with PODS be careful while committing the project file in git.
Answer to your question, just commit your Podfile, podfile.lock and .xcworkspace file in git and whenever the other teammate is getting the pull ask him to do a pod install and then open the .xcworkspace file to work as you did initially.

Adding an iPhone Project to an existing Github Project

I'm working on a bit of documentation code for an API project.
Someone else already has an existing github account where some people have already submitted a few projects. I will call it {http://github.com/monkeyhouse/}
I've created a project in Xcode (iPhone app), and have that stored under my normal Xcode git, which is backed up everything is fine.
What is the right bit of git foo that I need to put Xcode Project into
{http://github.com/monkeyhouse/examples/iPhoneClient}
I've tried creating a symbolic link to the project on my machine and that didn't work.
Following is a common way to do what you're wanting to do on Github:
Fork http://github.com/monkeyhouse/ under your own Github account.
Clone your forked version of the repo to your development machine.
Make the modifications you want directly to your cloned repo (e.g., don't use a symlink), adding examples/iPhoneClient to the local repo, and commit the changes.
Push your changes to your public Github fork of http://github.com/monkeyhouse/.
Submit a pull request with http://github.com/monkeyhouse/ to have them bring in the changes you pushed to your forked version if they're happy with them.

Including a cloned repo in a git repo

I'm writing an app in xcode, and I'm using git (though using the github app to commit and manage it, not xcode) for version control.
I use PXSourceList in the project, which I've cloned to my computer. I include the files as references in Xcode, so this means they aren't part of my git repo which syncs to github. So if someone were to download or clone from github they wouldn't be able to build without getting PXSourceList themself. How do I include PXSourceList, so that it is "referenced" in my repository?
Both on my computer (to my local clone) and on github (to PXSourceList on github)? So that PXSourceList will stay up to date in my repo when changes are made to it by others independant of my repo?
Subrepo or git-subtree. You have to move PXSourceList into your project tree in both cases

XCode 4.3 and SVN

I'm new to iOS developing, I haven't used earlier versions of XCode.
Yet I have stored my project on my local hd. Now I want to use some online subversion service.
I cannot seem to find the appropriate options in XCode. The hints that I googled all refer to a menu called SCM which I don't seem to have.
I created a new and empty repository online (webbased) and tried to configure XCode to use it by selecting the "Connect to a repository" menu when xcode starts. After some tweeking in the command line this "connect to a repository" succeeded but afterwards XCode simply closed itself again.
I tried copying the files that belong to my project to the path that I set up to be used with SVN manually. I opened the project in XCode from that path and after adding another file wanted to commit that change but couldn't find how to do that from within XCode.
Now I found that in XCode / Organizer / Repositories / MyProject is listed but has the type "GIT", which is wrong.
Do I have to change the repository type to SVN instead of GIT? If so, how can I?
When you created the project there was an option to put the project under source control. This option creates a git repository and is checked by default.
To use SVN you have to import your project into the SVN repository. (And you probably don't want it to be under git and svn at the same time, so you'll either delete the .git folder or recreate your project without the scm option selected.) Once the project is imported into your repository then you make sure Xcode knows about the repository and you can check the project out.
But really I'd recommend just using Git. It's a modern version control system with lots of nice features (though to do much of anything out of the ordinary requires using the command line) and there are nice project hosting sites for it like GitHub. I don't think SVN compares very well to git.

Resources