CocoaPods设置target支持的swift版本
2017-11-23 本文已影响532人
让历史重演
上一篇文章说道在Swift4.0
中如何引用3.0
版本的第三方库,详见这篇文章。但是如果Pods
中有很多第三方库都只支持3.0
,一个一个修改恐怕是要累死。而且每次执行pod update
之后之前设置的都会被重置,恐怕是想死的心都有了。
有一句是说:"懒惰"推动了人类的进步。所以程序猿总是有办法的。
Talk is cheap, Show me the code
platform :ios, '10.0'
use_frameworks!
target 'YourTarget' do
pod 'SnapKit', '~> 4.0.0'
pod 'Toast-Swift', '~> 2.0.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'Toast-Swift'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.2'
end
end
end
end
![](https://img.haomeiwen.com/i606479/59331113ac254e9c.jpg)
<推广> 综合计算器 是一款多功能计算器,可以计算房贷、个税、年终奖、利息、BMI指数以及大小金额的计算器,再也不用下载多个计算器找来找去了。还支持实时更新贷款利率哦~。