问题
Apple compatibility documentation is mentioning that:
Swift 4.1, the default version of Swift that’s included in Xcode 9.2.
Yet, using Xcode Version 9.2 (9C40b), the choice of Swift Language Version that I have are 3.2 and 4.0:
Is it a mistake in the documentation or a problem in Xcode? Can I use Swift 4.1 with Xcode 9.2? Will I be able to submit to AppStore using it?
回答1:
Apple documentation was incorrect, Swift documentation is correct.
Well, to be double sure of which version is supported, we'll test it:
Set your command-line tools to xcode 9.2 (9C40b). It will switch to Xcode default swift version.
sudo xcode-select --switch /Applications/Xcode.app
Test your swift version.
swift --version
Result is:
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
In conclusion, it's really an Apple documentation issue:
Swift 4.1 is only natively available using Xcode 9.3+
Update: 3 months later
With the release of Xcode 10 on June 4th 2018, Apple documentation was finally correctly updated, stating that Swift 4.2 is available using Xcode 10.0+.
来源:https://stackoverflow.com/questions/49102875/xcode-9-2-is-not-showing-swift-4-1