How do I specify multiple targets and projects in my podfile for my Xcode project?

Viewed 9147

I have one workspace that contains 3 projects (Project1, Project2), which Project1 contains 2 targets (Target1, Target2), and Project2 contains 1 target (target3). And the directory structure looks like the diagram below.

How do I setup Podfile so every target has the pod 'RestKit'?

I don't know what 'link_with' and Please write me the podfile and explain to me, thank you a lot.

    MyApp
|
+-- MyApp.xcworkspace
|
+-- Project1
|    |
|    +-- Target1.xcodeproj
|    +-- (source code)
|    |
|    +-- Target2
|    +-- (source code)
|
|
+-- Project2
|    |
|    +-- Target3.xcodeproj
|    +-- (source code)
|
+-- Target3
     |
     +-- (source code)
3 Answers

In the current version of CocoaPods xcodeproj is substituted with project.

Given the project structure:

MyApp
├- MyApp.xcworkspace
├- Project1
   ├- Target1.xcodeproj
   ├- Target2.xcodeproj
├- Project2
   ├- Target3.xcodeproj

Podfile will look like this:

workspace 'MyApp'

project 'Project1/Target1.xcodeproj'
project 'Project1/Target2.xcodeproj'

project 'Project2/Target3.xcodeproj'


target 'Target1' do
    project 'Project1/Target1.xcodeproj'
    pod 'RestKit'
end

target 'Target2' do
    project 'Project1/Target2.xcodeproj'
    pod 'RestKit'
end

target 'Target3' do
    project 'Project2/Target3.xcodeproj'
    pod 'RestKit'
end
Related