Quick Tip: Fix Use Legacy Swift issue in Xcode 8 Beta 3

Datetime:2016-08-23 04:13:28          Topic: Swift  Xcode           Share

Ok, This can be a right pain when you are using frameworks and you cannot run your Project. You might run into this annoying error:

Dependency Analysis Error Group

“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

CocoaPods Fix

If you are using CocoaPods to install frameworks and you want this to be fixed automatically every time you are doing a pod install, then you can add these lines to the end of your Podfile :

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
  end

Manually Embedded Framework

This is also very simple. All you need to do is go to Build Settings for the framework and to be safe your main project. Scroll down – It is right near the bottom and look for Use Legacy Swift Language Version . To the Right, there are three options when you click:

  • Unspecified
  • Yes
  • No

Using Objective-C?

If you keep getting the Legacy Swift issue and you’re using Objective-C you might be pulling your hair out. First, Check that none of your added frameworks are using Swift. If they’re not, check your Core Data model output.

There you have it, a quick way to fix the Legacy Swift issue in Xcode 8 Beta 3. Happy coding.





About List