I try to experiment with some of the new features of SPM that are recently implemented in swift 5.3. Like new binary dependencies and resources support. To test these new feature I went to swift.org and downloaded latest swift 5.3 development snapshot which is currently April 21, 2020. I installed it and selected as default toolchain in xcode preferences. However when I create new package with xcode it says swift-tools-version is 5.2. I tried to set it 5.3 like this // swift-tools-version:5.3
. But xcode says
package at ... is using Swift tools version 5.3.0 but the installed version is 5.2.0
So my question is how can i test latest developments for spm from development snapshots?
The Swift tools version declares the version of the PackageDescription library, the minimum version of the Swift tools and Swift language compatibility version to process the manifest, and the required minimum version of the Swift tools to use the Swift package.
Switching Swift Toolchain It can be done using Xcode, Go to Xcode->Preferences->Components-> Toolchains section and Select the Swift. 3.1. 1 snapshot, this will set the new Swift version for the local Xcode.
The Swift Package Manager is a tool for managing the distribution of Swift code. It's integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. The Package Manager is included in Swift 3.0 and above.
Also known as SwiftPM or SPM, it's been included in Swift since version 3.0. From the official repository: The Swift Package Manager is a tool for managing distribution of source code, aimed at making it easy to share your code and reuse others' code.
In Package.swift
// swift-tools-version:5.3
Although it's a comment and it should be ignored, it's not! change it to :
// swift-tools-version:5.2
Sometimes you need to delete .build
and .swiftpm
directories (that are hiddent by default) too.
Don't forget to close and reopen the project after the changes.
To use the new toolchain from the command line, you first need to export it: $ export TOOLCHAINS=swift
.
Then you can check which version you use with: $ swift --version
See apple documentation on managing multiple swift environment and choosing a swift version here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With