CocoaPods 1.9 现在支持 “XCFrameworks”, “podspec支持基于配置的依赖”, “指定 schemes 的代码覆盖率”, “use_frameworks link自定义”
XCFramework Support
推荐指数:***
随着Xcode11,苹果引入的新的Bundle格.XCFramework. 这种支持多个不同的架构和平台类型的.framework捆绑到一个结构里面。 二进制依赖项也需要XCFrameworks来支持macOS Catalina中引入的新的Catalyst平台。
用法
Pod::Spec.new do |s|
s.name = 'ToastLib'
s.version = '1.0.0'
# ...rest of attributes here
s.vendored_frameworks = 'ButterLib.xcframework'
end
Configuration-based dependencies for Podspecs
推荐指数:**
Podspecs也指出基于配置的依赖了
用法
Podfile修改
target 'BananaApp' do
pod 'Toast', :configurations => ['Debug']
end
Podspec修改
Pod::Spec.new do |s|
s.name = 'ToastLib'
s.version = '1.0.0'
# ...rest of attributes here
s.dependency 'ButterDebugging', :configurations => ['Debug']
s.dependency 'ErrorReportingTool', :configurations => ['Release']
end
注意目前只支持:Debug 和 Release
Code Coverage in Test Specs
推荐指数:***
支持code_coverage,依赖在1.7版本中引入的 scheme
用法
Pod::Spec.new do |s|
s.name = 'Networking'
s.version = '1.0.0'
# ...rest of attributes here
s.test_spec 'Tests' do |test_spec|
test_spec.scheme = {
:code_coverage => true, :environment_variables => {'FOO' => 'BAR' }
}
end
end
Swift Version Variants
推荐指数:*** 现在,在podspec里使用swift_versions 可以指定多个swift版本,配合Podfile里面supports_swift_version使用
用法
Podspec
Pod::Spec.new do |s|
s.name = 'CannonPodder'
s.version = '1.0.0'
# ...rest of attributes here
s.swift_versions = ['4.0', '5.0']
end
Podfile
target 'SampleApp' do
supports_swift_version '< 5.0'
pod 'CannonPodder'
end
target 'SecondApp' do
supports_swift_version '>= 5.0'
pod 'CannonPodder'
end
use_frameworks! Linkage Customization
推荐指数:***** 现在Swift支持static linking,CocoaPods扩展了DSL,允许指定连接包的类型。
用法
use_frameworks! :linkage => :static
来源:oschina
链接:https://my.oschina.net/u/1993252/blog/3190654