Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

“Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift

I just did the last Xcode update (8.3), and I have the message :

“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.

Knowing that the "Use Legacy Swift Language Version" option has just been removed from the build settings, how can I generate my app in Swift 2.3 without doing any conversion for now ?

like image 684
ΩlostA Avatar asked Apr 05 '17 09:04

ΩlostA


5 Answers

In the navigator selection bar, click the magnifying glass, then search for "SWIFT_VERSION" You will find the places in the project where you can adjust the swift version accordingly.

enter image description here

enter image description here

like image 112
ScottyBlades Avatar answered Oct 30 '22 18:10

ScottyBlades


You can't. XCode 8.2 was the last version to support Swift 2.3. You have to either update to Swift 3 or use Xcode 8.2.

like image 28
VojtaStavik Avatar answered Oct 30 '22 19:10

VojtaStavik


In My case I selected Pod and changed swift version for specific pod. This works for me.

enter image description here

like image 20
pallavi Avatar answered Oct 30 '22 17:10

pallavi


To programmatically change swift version of pods, you may add this inside your Podfile

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if ['Alamofire','OtherPod','AnotherPod'].include? target.name
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '4.0'
            end
        end
    end
end

In Swift 4, if you are using objective-c as well,

you may turn on @objc inference so the swift project will run properly on objective-c.

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if ['Alamofire','OtherPod','AnotherPod'].include? target.name
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_SWIFT3_OBJC_INFERENCE'] = 'On'
            end
        end
    end
end
like image 32
Ted Avatar answered Oct 30 '22 18:10

Ted


You cannot as XCode 8.2 was the last version to support Swift 2.3. You will have to either update your code to Swift 3 or use Xcode 8.2.

like image 27
Sneha Avatar answered Oct 30 '22 18:10

Sneha