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?
How to change Swift version from 5 to 4 in Xcode?
Perhaps this answer in the Apple exchange will help: apple.stackexchange.com/questions/181472/… –
Slapdash
See How do I see which version of Swift I'm using –
Eliason
@Eliason thanks man, that worked! –
Windjammer
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.
What if this is a Swift Package? –
Boltonia
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"))]
)
swiftLanguageVersions
is 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-version
flag.
© 2022 - 2024 — McMap. All rights reserved.