ios - CocoaPods: How can I have multiple workspaces reference the same pods -


i have several xcode workspaces, each containing several projects. projects in these workspaces related , need reference several of same cocoapods.

i want create single common directory can download 1 copy of each pod use, can't figure out how set podfile treats each workspace independently. happens when 2 workspaces named, second 1 gets both non-pod projects.

to simplify things, created 2 simple projects, fooproject , barproject, each contained in own workspace (fooworkspace , barworkspace). clarity, directory structure looks this:

+ common   - podfile   - podfile.lock   + pods  + workspace1   - fooproject.xcodeproj   - fooworkspace.xcworkspace  + workspace2   - barproject.xcodeproj   - barworkspace.xcworkspace 

here's podfile:

# uncomment line define global platform project platform :ios, '8.0'  def common_pods   pod "consolebanner" end  target 'fooproject'   project '../workspace1/fooproject.xcodeproj'   workspace '../workspace1/fooworkspace.xcworkspace'   common_pods end  target 'barproject'   project '../workspace2/barproject.xcodeproj'   workspace '../workspace2/barworkspace.xcworkspace'   common_pods end 

this trick. downloads pod 1 time , puts in shared directory below file. the problem updates barworkspace include not barproject , pods project, fooproject. first project/workspace referenced in podfile works properly.

i tried adding inherit! :none within target blocks, didn't have effect. considered creating separate podfiles peers in same directory, seems podfile has named, exactly, podfile.

how can have projects separate workspaces reference same podfiles?

i'm going answer own question based on research efforts on last few days. useful else @ point.

it doesn't seem can create podfile applies multiple workspaces. more think it, maybe way should be.

one podfile maps collection of pods. each pod has specific version number. presumably, different projects might work on require different versions of same pods. example, suppose project 1 uses pod x, version 3.0. project 2, because of legacy requirements, cannot use version 3.0 of pod x instead must use version 2.0.

in case, need 2 different podfiles, each pointing totally distinct collections of pods.

if have collection of projects tightly linked can guarantee use same versions of each pod depend on, maybe makes sense put projects single workspace. that's ended doing.

i may wrong of these details, , welcome corrections if so. hope writeup useful others getting started cocoapods.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - VueJS2 and the Window Object - how to use? -