Reputation: 2601
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 ?
Upvotes: 18
Views: 25023
Reputation: 3317
Updated, It works for me:
Step 1: Go to your ios folder and open podfile and do below simple changes;
first change:
target 'Runner' do
use_frameworks! # <--- add this single line
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
second changes:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['SWIFT_VERSION'] = '3.2' # <--- add this single line
end
end
end
Step 2: Open your current working project from Xcode i.e. Go to ios folder and open yourProjectName.xcworkspace file;
Add an empty Swift file to your Flutter iOS project in Xcode and accept to add bridging header.
Step 3: Open Terminal and again install using below command;
pod install
If project already open then close it and open again i.e yourProjectName.xcworkspace file , clean and build.
Upvotes: 0
Reputation: 23746
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
Upvotes: 6
Reputation: 513
In My case I selected Pod and changed swift version for specific pod. This works for me.
Upvotes: 7
Reputation: 2727
Change the Swift Language Version to supported version in Build settings
Upvotes: 2
Reputation: 13993
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.
Upvotes: 28
Reputation: 11276
Damn you Xcode, now I have to migrate to Swift 3.0. It clearly shows up this alert on opening or building an old project with Swift 2.3 so I suggest lets migrate :( :(
Upvotes: 2
Reputation: 2216
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.
Upvotes: 2
Reputation: 2472
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.
Upvotes: 10