how to update the swift compiler version into 5.1? - swift

I am trying to update the swift compiler language version to 5.1. But I am having the latest xcode version of Version 11.3.1 (11C504) Toolchain: Swift 5.1 Snapshot 2020-01-28 (a).
I downloaded the swift-5.1-DEVELOPMENT-SNAPSHOT-2020-01-28-a-osx package and installed but the is added in the toolchain. I couldn't see the required version in the compiler section.
So how to update that.
I have added the screen shot for more details

Related

Swift Version Conflict: this SDK is not supported by the compiler - using BUILD_LIBRARY_FOR_DISTRIBUTION setting. What could be the issue?

I'm building a Swift static library with:
Xcode 13.2 (Swift compiler 5.5.2)
iOS Deployment target 12.0
Build library for distribution YES
Skip install NO
Swift language version 5 and tried with 4.2
Dependency managed with CocoaPods:
Japx 3.0.0
Alamofire 5.2.2
RxSwift
When I try to add it to an iOS project with this setup:
Xcode 13.3 (Swift compiler 5.6)
iOS Deployment target 12.0
Swift language version 5 and tried with 4.2
and build I get this error:
Failed to build module 'LibraryX'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5.2 effective-4.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)', while this compiler is 'Apple Swift version 5.6 effective-4.2 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)'). Please select a toolchain which matches the SDK.
These are the headers in the .swiftinterface
// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.5.2 effective-4.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
// swift-module-flags: -target arm64-apple-ios12.0 -enable-objc-interop -enable-library-evolution -swift-version 4.2 -enforce-exclusivity=checked -Onone -module-name LibraryX
Obviously if I build the project with the same compiler version or building the library with the iOS project everything works fine. But the purpose here is to release a precompiled library and not its source code.
Every time that I lookup this error online I've found "You have to set Build library for distribution to Yes"
I tried to add the source code of the static library to a new Framework project, but I get the same result.
I also had this error, in my case it was unable to import a sub-dependency of my XCFramework during reading .swiftinterface file, however was showing this absolutely misleading error.
After repeatedly cleaning up DerivedData and trying different Xcode versions (13.0, 13.4.1) I've seen 2 errors: "this SDK is not supported by the compiler", and "No module named 'AnotherLib'" which was an incorrectly specified dependency inside of my Swift Package.
So, maybe only first part of the message is correct "Failed to build module 'LibraryX'", but the reason is something else, NOT the difference in compiler versions.

Swift Version Conflict: this SDK is not supported by the compiler, Please select a toolchain which matches the SDK

I'm using xCode 13.1 with macOS 12.0.1 Monterey. I added KingFisher and removed it from my pod. but my project is not built anymore. I got this error for one of my local SDKs:
Failed to build module 'CbSdk';
this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.4
(swiftlang-1205.0.26.9 clang-1205.0.19.55)', while this compiler is 'Apple Swift version 5.5.1
(swiftlang-1300.0.31.4 clang-1300.0.29.6)'). Please select a toolchain which matches the SDK.
What I've done but didn't work:
pod deintegrate and pod install.
restart xCode with clearing cache and DerivedData.
checkout old branch and commit that worked before.
moving code to another macBook that worked before.
download, install and select toolchain 5.4 (odd errors appeared -> )
changing swift compiler language of my target and project to swift 4 (It says you are using swift 5.5.1 again!)
note that I didn't update xcode or swift!
Taken from this Twitter thread.
You need to set the BUILD_LIBRARY_FOR_DISTRIBUTION build setting on the framework target
https://www.swift.org/blog/library-evolution/
https://developer.apple.com/videos/play/wwdc2019/416/
I fetch the same problem when I try to update a library. My Xcode version was 13.2 with the swift version5.5.2. But the library I want to update required a swift version of 5.7.0. Using toolchains in Xcode might be the solution but I decided to update the Xcode version with the latest.
I update my Xcode to the latest version 14.1 and the issue is resolved. Automatically the swift version is found on the latest Xcode.

Unable to load standard library for target arm64 error in XCode on Macbook Air M1

On new Mac with M1 chip get the error after the build of React Native app in XCode 12.4:
unable to load standard library for target 'arm64-apple-ios8.0'
failed to build module 'SciChart' from its module interface; the compiler that produced it, 'Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)'
What I already tried:
Reinstall XCode;
Changed Swift Language Version;
Deleted VALID_ARCHS reference according Xcode 12 Beta 2 - unable to load standard library for target 'arm64-apple-ios14.0-simulator'
On Macbook with intel chip there are no errors with the same app. And both of my Macbook have the same swift version:
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin20.3.0
Can you help me please!
Guys if you have old React Native projects just build it on Xcode with rosetta and you will save your nerves and time. I was looking the decision all week, but in the total it was so easy, just run Xcode with rosetta on M1: please try to open Xcode through Rosetta - Right click on Xcode in applications folder -> Get Info -> set Open with Rosetta to true

Apple swift-format update SwiftSyntax for Swift 5.3 toolchain

A build from the master branch of swift-format fails when executed against the Swift 5.3 toolchain that came with Xcode 12 Beta 2.
Based on the docs and the error message on execution the issue is almost definitely related to the SwiftSyntax versions not matching between swift-format and the Swift 5.3 toolchain. I've tried updating the swift-format Package.swift file to build swift-format against the SwiftSyntax release/5.3 branch but still get this error:
The loaded '_InternalSwiftSyntaxParser' library is from a toolchain that is not compatible with this version of SwiftSyntax
The question is what needs to be changed in swift-format Package.swift to make execution against the Swift 5.3 toolchain work?
The answer may be as "simple" as knowing which SwiftSyntax commit is packaged with the Swift 5.3 toolchain that came with Xcode 12 Beta 2. The answer may also be that I'm being way too bleeding edge for my own good.
Tony Allevato - I think you are the boss on this.
I was able to build Xcode 12 compatible version like this:
This revision of swift-format compatible with Swift 5.3(download it to your computer)
In Package.swift SwiftSyntax has to be pinned to Swift 5.3 tag
.package(url: "https://github.com/apple/swift-syntax", .revision("swift-5.3-RELEASE")),
swift build -c release
The binary will be in .build/release folder. Though there are some deprecation warnings, it works just fine.

Realm via Carthage for Xcode 9 Beta (9M136h)

Does anybody know how to get Realm, via Carthage, for Xcode Beta (9M136h)? If I try grabbing the most recent version (2.8.1) I get a compiler error, stating that the framework was built using Swift 3.1 and thus cannot be used in Swift 4 projects. However the release notes for 2.8.1 states that it's compatible for Xcode 9 Beta. Does the binary for 2.8.1 not work for X9B? Do I have to use a --no-binary flag (gross)?
Thanks in advance!