How can I use Swift 2.2 on Xcode8?

2019-05-25 01:04发布

问题:

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:

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!

回答1:

You have to enter the value 2.3 in there.

http://imgur.com/a/pcLIJ