我可以在Swift 3项目中使用Swift 2.3框架吗?

Cha*_*het 5 frameworks ios swift swift3

在我的项目中,我将所有私有swift 2.3文件迁移到swift 3.我想使用我在swift 2.3中编写的遗留框架,直到他们拥有一个快速的3版本.

我试图添加"使用旧版Swift版本=是".清除/构建我的项目,但我仍有一些麻烦,xCode要求我将我的框架迁移到swift 3(这是不可能的,因为它们是库)....

如何继续使用我的2.3库?

Jul*_*res 1

你可以尝试使用这个:

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
Run Code Online (Sandbox Code Playgroud)

请注意,这会将您的所有目标设置为 swift 2.3。如果你想要一个特定的,你可以这样做:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.pod_name == 'DesiredPod'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '2.3'
      end
    end
  end
end
Run Code Online (Sandbox Code Playgroud)