Search code examples
swiftmacos-mojavexcode11swift5

Can I compile swift 5.1 on Mojave with Xcode 11?


I have Xcode 11 installed on my Mojave system (10.14.6). But Xcode doesn't let me choose Swift 5.1. What am I missing?

[Swift language selection1 [My Xcode version]2 [My macOS Version]3


Solution

  • Xcode 11 comes with Swift 5.1 compiler (even on Mojave) and you can easily check it with writing code with some Swift 5.1 feature.

    func myFunc() -> String {
        "abc"
    }
    

    (SE-0255 Implicit returns from single-expression functions)

    Just choose Swift 5 and you can use Swift 5.1 features.