【发布时间】:2017-02-25 11:27:46
【问题描述】:
我正在开发框架,我已将此框架项目添加到宿主项目中。现在我想将 cocoapods pod(框架)添加到父(主机)项目中。并将同一个 pod 共享到子(框架)项目中。或者有什么我可以添加到 Podfile 并与子项目共享的东西。
SwiftProtoBuf 框架,我想用。而且我不想做伞式框架。
我们可以在父子项目之间共享 cocoapods pod
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
或者我是否需要将 pod 添加到两个项目中,例如
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
【问题讨论】:
标签: ios xcode cocoapods ios-frameworks cocoapods-1.2