Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding an Xcode subproject: Shouldn't all the source files get copied?

I am manually adding the SQLite.swift subproject to my project. As the directions indicated, I copied the .xcodeproj file to my project. This allows me see all the source files (unlike this SO question).

enter image description here

Everything seemed like it was working fine. However, I discovered that the source files of that subproject were not copied to my project. They are still in original location where I downloaded them. Is this by design? What if I want to share my project source code with other people in the future? They won't have the subproject source that is necessary for my project to work.

If I do need to copy the subproject source to my project, then how do I do that?

like image 910
Suragch Avatar asked Apr 22 '16 01:04

Suragch


People also ask

How do I add a sub project in Xcode?

Drag the subproject in via finder If you have setup your staticlibrary like I explained here you now need to tell the main project where it can find the public header. With that done, you should now be able to import the static library header and use it in your main app.

How do I add source files to Xcode?

In the Xcode Project Navigator, Control-click the SUP101 folder, then select Add Files to "SUP101". Select the Generated Code folder, unselect Copy items into destination group's folder (if needed), and click Add.

How do I copy one project to another in Xcode?

Click the arrow button to the right of the file and select Move or Copy file from the dropdown menu. When you choose Copy this file from the move or copy dropdown, you will then be able to select which project to copy it to. You can make a copy of the file in the existing project or in another project.


2 Answers

Add it to your filesystem-structure first. For example by pressing "Show in Finder" on the "Chimee"-project which will lead you to the folder it's located in. Then copy the SQLite-project structure in there.

Afterwards you can then drag&drop the xcodeproj into your project which will then still link to its original path, but as it's now inside your project-structure isn't a problem anymore.

I guess that this is by design, because when you try it via Add files to "YourProject" you can select the Copy items if needed-option but it will still not get copied (only with .xcodeproj-files, it works with all other filetypes)

like image 70
TMob Avatar answered Sep 26 '22 01:09

TMob


After doing more research, I now feel that using a dependency manager (like CocoaPods or Carthage) is a better option than manually adding the framework to the project.

  • This will allow easier updating in the future.
  • Github source code sharing and App Store submission issues have already been considered.

Using Carthage is not too difficult if you follow this excellent guide: Carthage Tutorial: Getting Started

Notes

  • Delete the framework files that you manually copied in before installing the framework with Carthage.
  • I will leave @TMob's answer as accepted for now, but I am no longer pursuing that route.
like image 34
Suragch Avatar answered Sep 26 '22 01:09

Suragch