this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)'). Please select a t

I am trying to distribute an XCFramework through a local Swift Package.

I have installed the same XCFramework on my Target through Pod and it works fine but When I moved it into a Swift Package, I get the error above.

I have also changed the version of Swift in my package but the error persists.

// swift-tools-version: 5.7.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "SmileIDentity",
    platforms: [.iOS(.v16)],
    products: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "SmileIDentity",
            targets: ["SmileIDentity", "Smile_Identity_SDK"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    ],
    targets: [
        .target(
            name: "SmileIDentity",
            dependencies: []),
        .binaryTarget(name: "Smile_Identity_SDK", path: "./Smile_Identity_SDK.xcframework"),
        .testTarget(
            name: "SmileIDentityTests",
            dependencies: ["SmileIDentity"]),
        
    ]
)

Because you need to recompile the xcframework with the same version of Xcode swift 5.7.2. If you own the source make the swift package a source package and not a binary package.

In my case, I'm developing a Framework that uses 3rd party Swift Packages internally. Originally, I thought this error was being thrown because I upgraded to Xcode 15. Turns out, it was completely unrelated.

If you are using 3rd party libraries and want to export a Framework, you must include the "@_implementationOnly" tag in front of the imports.

Example: "@_implementationOnly import BoltsSwift".

If you do this, it will not include these 3rd party library imports in the binary modules within the framework. This is great because the users of your framework don't care about the 3rd party libraries used in the back-end. Hope this helps at least one person! I rarely see anything online about the @_implementationOnly tag.

I'm having a similar issue: build xcframework with Xcode 14.1 and use it in Xcode 15.0 with Library Evolution On

  • Cocoapods: works
  • SPM: compile error "the SDK is built with 'Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)'). Please select a toolchain which matches the SDK."

SPM only works if I rebuilt with same Xcode version + turn off Library evolution.

this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)'). Please select a t
 
 
Q