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

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

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

如何继续使用我的2.3库?

你可以尝试使用这个:

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 

请注意,这会将所有目标设置为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 

您可以设置Build Settings-> Swift Compiler – Version-> Use Legacy Swift Language Version for Yes 在此处输入图像描述