Using Cocoapods in an app extension using a framework

后端 未结 3 1369
滥情空心
滥情空心 2020-12-09 03:14

I have an app (let\'s call it MyApp) written in Swift with the following targets :

  • MyApp : the main target
  • MyAppKit : a targ
3条回答
  •  情深已故
    2020-12-09 03:52

    I don't know you. But for me, it's totally legit and reasonable to have the extension and the host app contain all the pods that a framework defines. And this is what i mean:

    def shared_pods
        pod 'Alamofire'
    end
    
    target 'Framework' do
        shared_pods
    end
    
    target 'Host' do
        shared_pods
        // Some other pods
    end
    
    target 'Extension' do
        shared_pods
    end
    

    I know you are worried about but if you think about it, all those 3rd party frameworks you use, they all have dependencies. You don't have to worries about them because Cocoapods takes care of them for you. If you want to utilise that, then you'll need to put a local pod entry in the list.

    target 'Host' do
        pod Framework, :path => '../Framework'
    end
    

    But then you have to maintain the podspec file.

提交回复
热议问题