我希望我的 iOS 应用程序的主模块编译 Swift 4.0,而 CocoaPods 模块编译 swift 3。
PS:使用 Xcode 9 beta 2。
最佳答案
如果您使用的一些 pod 是用 Swift 4 编写的,但有些是 Swift 3.2,您可以通过以下方式为它们指定 SWIFT_VERSION 值:
swift_32 = ['Pod1', 'Pod2', 'Pod3'] # if these pods are in Swift 3.2
swift4 = ['Pod4', 'Pod5', 'Pod6'] # if these pods are in Swift 4
post_install do |installer|
installer.pods_project.targets.each do |target|
swift_version = nil
if swift_32.include?(target.name)
swift_version = '3.2'
end
if swift4.include?(target.name)
swift_version = '4.0'
end
if swift_version
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = swift_version
end
end
end
end
关于ios - 如何使用 Swift 3 中的 Pod 使用 Swift 4.0 构建 xcode 9 项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45198857/