user3583973
user3583973

Reputation: 5

Carthage update failing with error message SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2

Currently I'm on xcode version 10.1 and swift version 4.2. I'm using CryptoSwift lib and when I tried carthage update it is failing to build with error message SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2.

I'm trying solve the problem:

  1. if swift_verion > 4.2 {
      //Download x version
    }else {
      //Download y version
    }
    
  2. Or there any way to compile build with available version only?

Build settings from command line:

    CARTHAGE = YES
    CLANG_ENABLE_CODE_COVERAGE = NO
    CODE_SIGN_IDENTITY = 
    CODE_SIGNING_REQUIRED = NO
    GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
    ONLY_ACTIVE_ARCH = NO
    SDKROOT = iphoneos12.1
    SKIP_INSTALL = YES
    STRIP_INSTALLED_PRODUCT = NO
    TOOLCHAINS = com.apple.dt.toolchain.Swift_4_2

note: Using new build system
note: Planning build
note: Constructing build description
Build system information
error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'CryptoSwift')

Upvotes: 0

Views: 1960

Answers (2)

Florian Pfisterer
Florian Pfisterer

Reputation: 1265

I fixed it using the following in my Cartfile:

github "krzyzanowskim/CryptoSwift" "swift42"

This uses the Swift 4.2 branch of CryptoSwift and you won't have to convert your project.

Upvotes: 0

Erica Stevens
Erica Stevens

Reputation: 11

It seems like the CryptoSwift lib was updated to Swift 5 using Xcode 10.2 in their latest release (1.0.0). You are getting this error because you need to update your Xcode Version and migrate your project to Swift 5, if you want to point to this new version. Projects using Swift 5 can only be built with Xcode 10.2.

Note that Apple is dropping support for Swift 3 pretty soon, and it is probably a good idea to upgrade pretty soon. Managing dependencies during migrations can be a pain because you have no control over when other development teams will switch over.

Upvotes: 1

Related Questions