Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode 8 swift update with error "Use Legacy Swift Language Version"

When i opened my project into Xcode 8 then I got the following error

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

referring to a similar post on StackOverflow , Use Legacy Swift Language Version YES/NO . But it's not working for me either by doing YES or No value ?

Please help.

I have checked Use Legacy Swift Language Version to options YES/NO please check attached screenshot Use Legacy Swift Language Version-YES

Use Legacy Swift Language Version-NO

like image 532
rakex Avatar asked Sep 21 '16 12:09

rakex


3 Answers

Add this to your pod-file:

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'yourappname' do

pod 'yourpodlists'

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

Run pod-install again. Clean your project with cdm + alt + shift + k. Clean again using cmd + shift + k. Restart Xcode. Build. Now it should work.

If you're not using cocoapods, you should be able to fix this issue by setting the Compiler Version attribute Use Legacy Swift Language Version from unspecified to Yes or No.

Build settings of the project or library ->

enter image description here

like image 129
David Seek Avatar answered Nov 17 '22 12:11

David Seek


try converting swift code to swift3 or swift 2.3. edit -> convert -> to current swift-> select swift 3 or swift 2.3. This will works.

like image 2
Savitha Avatar answered Nov 17 '22 13:11

Savitha


enter image description hereI am using Xcode 8.3.3 After surfing too much and working around i found this solution, and this worked for me.

Here are the steps.
1=> select your target from Xcode
2=> go to build setting
3=> search for "Swift Language Version"
4=> change it to swift 3. (or accordingly.)
like image 2
Aklesh Rathaur Avatar answered Nov 17 '22 13:11

Aklesh Rathaur