Say you’ve got another git repos of one xcode project (like a library) and you want to build and compile it in another. Here is how you include the library xcode project in your new xcode project.
Step 1: Set up git submodule
Get the name of the git repos you want to include and add it as a submodule
git submodule add firstname.lastname@example.org/yyy.git /externals/name git submodule update --init --recursive
This adds the external repos to your project, and then updates it.
Go here for more details.
Step 2: Drag in your project
Now open finder, and drag in your external project folder from your submodule folder. Not somewhere else on disk.
Doing this will add the subproject to your new project, while also creating the necessary schemes to build your external project as a library with your new one.
You can now flip back and forth between schemes and edit as required.