如何在Podfile中为每个Pod设置旧版Swift版本

我目前在中将传统设置为Podfileto SWIFT_VERSION = 2.3,但是我正在使用的某些库是Swift

3.0,这意味着我需要为每个Swift 3.0pod No上的所有pod 手动设置传统pod

install。如何在Podfile安装程序中配置每个Pod版本?

这是我正在设置的:

post_install do |installer|

installer.pods_project.targets.each do |target|

target.build_configurations.each do |config|

config.build_settings['SWIFT_VERSION'] = '2.3'

end

end

end

如果设置为config.build_settings['SWIFT_VERSION'] = '3.0',则Swift

2.3豆荚有问题。最好的解决方案是,如果我们分别设置每个Pod旧版本,以避免必须手动设置它。

回答:

我在搜索如何将Xcode 9的SWIFT_VERSION设置为3.2时发现了这一点。

使用本身和多个依赖项需要3.2而不是4.0的AirMapSDK,这是一个如何为可能遇到此问题的其他人设置Pod专用SWIFT_VERSION的示例。

post_install do |installer|

installer.pods_project.targets.each do |target|

if ['AirMapSDK', 'PhoneNumberKit', 'Lock', 'RxSwift', 'RxSwiftExt', 'RxCocoa', 'RxDataSources', 'ProtocolBuffers-Swift'].include? target.name

target.build_configurations.each do |config|

config.build_settings['SWIFT_VERSION'] = '3.2'

end

end

end

end

您可以更改if数组,以指定设置版本所需的任何Pod。

以上是 如何在Podfile中为每个Pod设置旧版Swift版本 的全部内容, 来源链接: utcz.com/qa/405731.html

回到顶部