I have a large workspace that I want to use a base, to create another project on top of it, using it's code. Instead of working directly on the code, I would like to create another project myProject, with myPodProject, so I could access their code and their pods, and add my code and pods independently.
The original structure:
CoreApp
|
+-- CoreApp.xcworkspace
|
+-- CoreProject.xcodeproj
+-- Pods.xcodeproj
What I have done is to create my own workspace with my project, draged all the core projects into the workspace and pointed to the core projects with "Header Search Path".
So the new structure is:
MyApp
|
+-- MyApp.xcworkspace
|
+-- MyProject.xcodeproj
+-- CoreProject.xcodeproj
+-- Pods.xcodeproj
Till here all good.
Now, I would like to have my own pods. But it seems it is a problem having 2 Pods.xcodeproj in the same workspace.
What should I do to have this?
MyApp
|
+-- MyApp.xcworkspace
|
+-- CoreProject.xcodeproj
+-- CorePods.xcodeproj
+-- MyPods.xcodeproj
+-- MyProject.xcodeproj
UPDATE: It is possible to have two "Pods.xcodeproj" in the same workspace, but is impossible to have those in the same directory.
If you checkout "CoreProject" into a subdirectory of "MyProject", you can execute pod install
in both directories "MyProject" and "CoreProject". In this way, both projects can have its own "Pods.xcodeproj".
This is the file structure after doing it.
MyProject
├── MyProject
├── MyProject.xcodeproj
├── MyProject.xcworkspace
├── Podfile
├── Podfile.lock
├── Pods
│ └── Pods.xcodeproj
└── CoreProject
├── Core.m
├── CoreProject
├── CoreProject.xcodeproj
├── CoreProject.xcworkspace
├── Podfile
├── Podfile.lock
└── Pods
└── Pods.xcodeproj
Finally you should do following steps.
Don't use "CoreProject.xcworkspace" to edit "MyProject".
This is the project structure in this case.
MyProject.xcworkspace
|
+-- MyProject.xcodeproj
+-- Pods.xcodeproj (for MyProject)
+-- CoreProject.xcodeproj
+-- Pods.xcodeproj (for CoreProject)
If you can touch the CoreProject's Pods, the following solution is suitable.
You should create a new "Pods.xcodeproj" and share it with "MyProject" and "CoreProject".
The project structure looks like below (same as your "new structure", but pods is replaced by new one).
MyApp
|
+-- MyApp.xcworkspace
|
+-- MyProject.xcodeproj
+-- CoreProject.xcodeproj
+-- Pods.xcodeproj (your own)
This is a sample Podfile for your workspace. If you link "CoreProject" from "MyProject", in this case, you can use "AFNetworking" in both projects, but can use "SDWebImage" only in "MyProject".
Podfile
workspace 'MyApp'
xcodeproj 'CoreProject.xcodeproj'
xcodeproj 'MyProject.xcodeproj'
target "CoreProject" do
pod 'AFNetworking'
xcodeproj 'CoreProject.xcodeproj'
end
target "CoreProjectTests", :exclusive => true do
pod 'OCMockito'
xcodeproj 'CoreProject.xcodeproj'
end
target "MyProject" do
pod 'SDWebImage'
xcodeproj 'MyProject.xcodeproj'
end
target "MyProjectTests", :exclusive => true do
pod 'OCHamcrest'
xcodeproj 'MyProject.xcodeproj'
end