Manage dependencies of multiple projects in one workspace

I have a workspace like this:

MyAppiOS project
MyAppMacOS project
Pods
   AFNetworking

      

The Pods project was added to the initial workspace (MyAppiOS project) using podfile

platform :ios, '5.0'

pod 'AFNetworking', '1.1'

      

and the team pod install

Now I want MyAppMacOS to communicate with AFNetworking as well.
I've seen an example of subfiles with multiple targets, but with a common platform. I couldn't find an example podfile that would work across multiple platforms.
I also tried using two subfiles for two projects, but the team pod install

creates two workspaces.

What is the best way to use CocoaPods in this scenario?

+3


source to share


2 answers


What about

MyAppiOS project with folder
    Pods
       AFNetworking
MyAppMacOS project with folder
    Pods
       AFNetworking
MyAppCommon folder

      



You can still add files from MyAppCommon to platform specific projects.

0


source


Try something like this where you specify the workspace to be created and the platform for each goal / project combination. You can customize project files to point to different folders where each platform source is located.




workspace 'MyWorkspace.xcworkspace'
platform :ios

def import_pods
  pod 'AFNetworking'
end

target :'MyAppiOS' do
    platform :ios
  xcodeproj 'MyAppiOS.xcodeproj'
  import_pods
end

target :'MyAppOSX' do
    platform :osx
  xcodeproj 'MyAppOSX.xcodeproj'
  import_pods
end

      

0


source







All Articles