I've create a workpace and added two projects in it. The directory structure of my project is:
How can I've single podfile for both the projects? I created one pod file under project1 and manually moved it under root directory. Here is how pod file looks like.
workspace ‘testworkspace’
xcodeproj ‘project1/project1.xcodeproj’
target ‘project1’ do
pod 'testworkspace', :path => '.'
pod ‘AFNetworking’
end
xcodeproj ‘project2/project2.xcodeproj’
target ‘project2’ do
pod 'testworkspace', :path => '.'
pod ‘MBProgressHUD’
end
_pod install --verbose_ gives me error: Unable to find a target named project1
Offhand, not at a computer, I think you want to use the targets as scopes for the xcproject/workspaces. So something like this per target to integrate
target ‘project1’ do
workspace ‘testworkspace’
xcodeproj ‘project1/project1.xcodeproj’
pod 'testworkspace', :path => '.'
pod ‘AFNetworking’
end
tried above solution but its still giving me same issue as I specified in question.
@artiy can you please share your modified podfile?
updated pod file is :
workspace 'testworkspace'
xcodeproj 'project1/project1.xcodeproj'
target 'project1' do
workspace 'testworkspace'
pod 'AFNetworking'
end
xcodeproj 'proj2/proj2.xcodeproj'
workspace 'testworkspace'
target 'proj2' do
pod 'MBProgressHUD'
end
Try putting the xcodeproj
directives inside the target
blocks.
Solved my issue. Thanks a lot!!!
platform :ios, '9.0'
workspace 'TestWorkSpace'
xcodeproj 'Project1/Project1.xcodeproj'
xcodeproj 'Project2/Project2.xcodeproj'
target 'Project1' do
xcodeproj 'Project1/Project1.xcodeproj'
#Pods for Project1
pod 'SwiftyJSON', '~> 4.0'
end
target 'Project2' do
xcodeproj 'Project2/Project2.xcodeproj'
#Pods for Project2
pod 'SwiftyJSON', '~> 4.0'
end
Most helpful comment