Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Swift 2.3 frameworks in a Swift 3 project?

In my project I migrated all my private swift 2.3 files to swift 3. I would like to use my legacy frameworks written in swift 2.3 until they have a swift 3 version.

I tried to add "Use Legacy Swift Version = Yes". Clear/Build my project but I have still some trouble and xCode ask me to migrate my frameworks to swift 3 (which is just not possible because they are libraries)....

How can I continue to use my 2.3 libraries?

like image 292
Charly berthet Avatar asked Nov 09 '22 08:11

Charly berthet


1 Answers

You cay try using this:

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

Note that this will set all of your targets to swift 2.3. If you want one specific, you can do something like that:

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
like image 100
Julio Flores Avatar answered Nov 14 '22 21:11

Julio Flores