内容简介:最近升上 Swift 4.2,發現我用到的 Pods 有些還沒支援 4.2 導致編譯錯誤。解決方法也很簡單,只要指定每個 Pod target 的但是我們不能手動在 Xcode 裡頭調整,因為 CocoaPods 會把 Pods 的我們可以在
最近升上 Swift 4.2,發現我用到的 Pods 有些還沒支援 4.2 導致編譯錯誤。解決方法也很簡單,只要指定每個 Pod target 的 SWIFT_VERSION
為 4.0
即可。
但是我們不能手動在 Xcode 裡頭調整,因為 CocoaPods 會把 Pods 的 SWIFT_VERSION
設為跟你的 project 一樣,所以下次 pod install
又會被改掉。
我們可以在 Podfile
用 post_install
來自動修改,只要在 Podfile
結尾加入以下片段即可。
post_install do |installer|
installer.pods_project.targets.each do |target|
# 我們也可以懶惰不用 if,讓所有 pod 的版本都設為一樣的
if ['RxSwift', 'RxSwiftExt', 'RxCocoa', 'RxDataSources', 'ProtocolBuffers-Swift'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.0'
end
end
end
end
以上所述就是小编给大家介绍的《如何為各個 Pod 指定 Swift 版本》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
R Cookbook
Paul Teetor / O'Reilly Media / 2011-3-22 / USD 39.99
With more than 200 practical recipes, this book helps you perform data analysis with R quickly and efficiently. The R language provides everything you need to do statistical work, but its structure ca......一起来看看 《R Cookbook》 这本书的介绍吧!