29

Is it possible to change Carthage Swift version used to build the frameworks?

I'm trying to migrate my project to swift 3 (on Xcode 8 beta), and the third party libraries are the only thing that stops my project from compiling. While using specific branches for swift 3, Carthage throws errors about the new Swift syntax.

Any help will be appreciated!

Nadav96
  • 1,274
  • 1
  • 17
  • 30
  • Possible duplicate of [How to select Swift toolchains when building with Carthage](https://stackoverflow.com/questions/39931725/how-to-select-swift-toolchains-when-building-with-carthage) – jonahb Mar 26 '19 at 18:08
  • See https://stackoverflow.com/questions/39931725/how-to-select-swift-toolchains-when-building-with-carthage – jonahb Mar 26 '19 at 18:09
  • @jonahb This question was asked almost 3 years ago, and already have been answered :) (plus this question is older than those you listed) – Nadav96 Mar 27 '19 at 19:15
  • As a comment on the accepted answer points out, that response "does not answer the question of how to choose the Swift version." The page I linked to does. – jonahb Sep 15 '19 at 17:11

2 Answers2

57

Carthage uses the command line tool xcodebuild to build the frameworks. The version of Xcode used by the command line system is determined by the value selected by the tool xcode-select

Usage: xcode-select [options]

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example, 
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
  -h, --help                  print this help message and exit
  -p, --print-path            print the path of the active developer directory
  -s <path>, --switch <path>  set the path for the active developer directory
  --install                   open a dialog for installation of the command line developer tools
  -v, --version               print the xcode-select version
  -r, --reset                 reset to the default command line tools path

It needs to point to the Developer SDK directory, so you can use --print-path to check where it's currently pointing.

xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

Then to change it just run sudo xcode-select --switch <path-to-beta-xcode>/Contents/Developer

bobDevil
  • 27,758
  • 3
  • 32
  • 30
0

There is a bug report on Carthage's GitHub about XCode 8 and broken compatibility. You may want to follow that issue's thread on their repo:

https://github.com/Carthage/Carthage/issues/1440

Another related reported issue in Carthage's repo is: https://github.com/Carthage/Carthage/issues/1445

nbloqs
  • 3,152
  • 1
  • 28
  • 49