I am programming with Swift in Xcode (MacBook Air 2015) and I want to change my Swift version from 5 to 4. How to do that?
-
1Perhaps this answer in the Apple exchange will help: apple.stackexchange.com/questions/181472/…blurfus– blurfus2019-07-04 21:00:33 +00:00Commented Jul 4, 2019 at 21:00
-
5See How do I see which version of Swift I'm usingrmaddy– rmaddy2019-07-04 21:20:19 +00:00Commented Jul 4, 2019 at 21:20
-
2@rmaddy thanks man, that worked!surftijmen– surftijmen2019-07-04 22:07:43 +00:00Commented Jul 4, 2019 at 22:07
Add a comment
|
2 Answers
Project ► (Select Your Project Target) ► Build Settings ► (Type
'swift_version' in the Search bar) Swift Compiler Language ► Swift
Language Version ► Click on Language list
Here you can change your version.
1 Comment
IgorGanapolsky
What if this is a Swift Package?
For SPMs you can do as follows:
let package = Package(
name: "Foo",
products: [
.library(
name: "Foo",
targets: ["Foo"])
],
dependencies: [
],
targets: [
.target(
name: "Foo",
dependencies: [])
],
swiftLanguageVersions: [.version("5.7"))]
)
swiftLanguageVersionsis the version of the Swift language to use for compiling Swift sources in the package. The value is passed as-is to the Swift compiler's-swift-versionflag.
