2

I had a project on Swift2.3 and XCode7. It worked well.

When I have updated it to XCode8 and Swift3 the project does not show anything on the emulator so I decided to use, at least by the moment, Swift2.2 on Xcode8 (I have a copy of the project in Swift2.2) but it gives to me 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.

I have tried going to Build Settings > Use Legacy Swift Language Version and change the default value from Unspecified to No but the error still comes.

Further, I only have three possible values to choose: Yes, No or Unspecified but none of them work to fix the error. Nothing about SWIFT_VERSION value.

How can I continue using Swift2.2 on XCode8 without any error?

EDIT: Here you have an image about the options that I actually have:

enter image description here

EDIT 2: I know about this question Use Swift 2.2 in Xcode 8? but as you can see on the image above I do not have the option SWIFT_VERSION so the only answer that appears there does not work for me.

Thanks in advance!

Community
  • 1
  • 1
Francisco Romero
  • 12,787
  • 22
  • 92
  • 167
  • 1
    You have to set the Swift version for each target - also for Frameworks in Pods, if you use CocoaPods – Dejan Skledar Sep 14 '16 at 12:47
  • 1
    You were using Swift 2.2 with Xcode 7, not 2.3. – JAL Sep 14 '16 at 12:49
  • @DejanSkledar Where can I set it? – Francisco Romero Sep 14 '16 at 14:10
  • in the Build Settings – Dejan Skledar Sep 14 '16 at 14:11
  • @DejanSkledar I do not know if you refer to 'iOS Deployment Target' but there I have iOS 9.3 version to target it (the latest I had on my last project). I cannot see anymore option about versions. – Francisco Romero Sep 14 '16 at 14:14
  • @JAL I am so new to Swift and I was using the latest version but maybe I was wrong and I was using 2.2 (as I could see that in XCode8 they implement 2.3, correct me please if I am wrong). Also, it does not matter if I have my project on 2.2 or whatever. If I use the command `swift -version` on the project folder it says to me that it is on 3.0. – Francisco Romero Sep 14 '16 at 15:10
  • @Error404, Did you solved this issue? – Sunil Targe Sep 17 '16 at 06:32
  • @SunilTarge No, I had to rewrite my project on Swift3 because I was not able to make it work as before because all constraints broke and anything was shown on the simulator. I think there should be a better way to do that without have to rewrite the full project because it is like try to kill a fly with a gun. – Francisco Romero Sep 19 '16 at 06:39
  • @Error404, Thanks for updates. – Sunil Targe Sep 19 '16 at 10:39

1 Answers1

0

You have to enter the value 2.3 in there.

http://imgur.com/a/pcLIJ

M_G
  • 1,208
  • 1
  • 11
  • 16
  • What do you mean when you say "there"? – Francisco Romero Sep 14 '16 at 14:11
  • In `Build Settings > Use Legacy Swift Language Version` for your target or the project itself. – M_G Sep 14 '16 at 14:14
  • There I have `Debug` and `Release` options. But any of them let me to choose 2.3 version. I think I am missing something because all of your refer to the same option and I cannot see anything related in that option. – Francisco Romero Sep 14 '16 at 14:20
  • I have edited my question with an image of the options that I have. I cannot set 3.0 where you have set it. – Francisco Romero Sep 14 '16 at 14:36
  • Could you remove the multiple values for debug and release? I guess you won't use different values for each deployment anyway. – M_G Sep 14 '16 at 14:38
  • I have removed them but I still have the three options. I will update my image now. – Francisco Romero Sep 14 '16 at 14:39
  • I double checked with other projects in Xcode 8 but in Swift projects I can enter any value. Maybe try to create a new project with Xcode 8 and move everything over there. Alternatively edit the project file by hand (but backup before). – M_G Sep 14 '16 at 14:50