2

i am developing Framework, i have added this framework project into host project. now i want to add cocoapods pod(framework) into parent(host) project. and share same pod into child(framework) project. or is there something i can add to Podfile and it will get share with child project.

SwiftProtoBuf framework, i want to use. and i don't wish to make umbrella framework.

can we share cocoapods pod between parent and child project

platform :ios, '8.0'
use_frameworks!

workspace 'ParentApp.xcworkspace'

abstract_target 'commonpods' do
    pod 'SwiftProtobuf', git: 'https://github.com/apple/swift-protobuf.git', :tag => '0.9.24'

    target 'ParentApp' do
        project 'ParentApp.xcodeproj'

    end

    target 'ChildApp' do
        project 'ChildFramework/ChildApp.xcodeproj'
    end

end

or do i need to add pod to both project something like

platform :ios, '8.0'
    use_frameworks!
        target 'ParentApp' do
            project 'ParentApp.xcodeproj'
    pod 'SwiftProtobuf', git: 'https://github.com/apple/swift-protobuf.git', :tag => '0.9.24'
        end

        target 'ChildApp' do
            project 'ChildFramework/ChildApp.xcodeproj'
      pod 'SwiftProtobuf', git: 'https://github.com/apple/swift-protobuf.git', :tag => '0.9.24'
    end
CMS Signage
  • 2,755
  • 1
  • 26
  • 50

1 Answers1

4

After little Struggle, i am able to solve it, it may help some-one in need.

  1. Create Blank .xcworkspace , Xcode->File->New->Workspace

  2. Open your .xcworkspace file in xcode, Add your Host(partent) project into .xcworkspace

  3. add your framework(child) project in .xcworkspace.

and Podfile structure is like.

platform :ios, '8.0'
use_frameworks!

workspace 'MyWorkSpaceName.xcworkspace'

abstract_target 'CommonPods' do
    pod 'SwiftProtobuf', git: 'https://github.com/apple/swift-protobuf.git', :tag => '0.9.24'

    target 'MyHostAppProject' do
        project 'MyHostAppProject/MyHostAppProject.xcodeproj'

    end

    target 'MyFrameworkProject' do
        project 'MyFrameworkProject/MyFrameworkProject.xcodeproj'
    end

end

make sure .xcworkspace is created and both your project is added into workspace, then only install pods to your project.

CMS Signage
  • 2,755
  • 1
  • 26
  • 50