【发布时间】:2018-07-08 09:21:18
【问题描述】:
应用有 20 多个目标。
每次添加目标时,我都需要更新我的 podfile:
Podfile
target 'SomeNewTarget' do
runAllPods // Block that contains all "pod ...."
end
我的问题:
是否有向所有目标添加依赖项的通用方法? 我基本上想为除测试目标之外的所有目标添加相同的依赖项。
完整的podi:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
inhibit_all_warnings!
def runAllPods
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Swinject', '~> 2.1.0'
pod 'SwinjectAutoregistration', '2.1.0'
pod 'IHKeyboardAvoiding', '4.0'
pod 'SnapKit', '3.2.0'
pod 'Material', '~> 2.10.2'
pod 'RxSwift', '~> 3.0'
pod 'RxCocoa', '~> 3.0'
pod 'PureLayout'
pod 'Alamofire', '~> 4.5'
....更多依赖项
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'HydraAsync' || target.name == 'DKImagePickerController' || target.name == 'WhatsNew' || target.name == 'Closures'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.0'
end
end
end
end
target 'Target1' do
runAllPods
end
target 'Target2' do
runAllPods
end
target 'Target3' do
runAllPods
end
target 'Target4' do
runAllPods
end
...
target 'Target 20' do
runAllPods
end
...更多目标
【问题讨论】:
标签: ios swift cocoapods dependency-management swift-package-manager