Home > Mobile >  Change Swift Version Project is Built With
Change Swift Version Project is Built With

Time:04-06

I'm using Vapor, and I've run into a problem where the change to Xcode 13.3 from 13.1 now means the project (without changes) will no longer build.

How can I change the version of Swift that a Vapor project will build to? Since this isn't an app, the usual convenient configuration UI isn't available, so I presume this has to be done in a configuration file, or via the terminal. Just don't know how, is all...

CodePudding user response:

I think what you mean is the version of swift-tools that gets invoked rather than swift. Change the first line of Package.swift in your project's folder to use the current version needed by the latest vapor version 4:

// swift-tools-version:5.5

Then use Xcode to try to build. If this doesn't work, try Using the Clean Build Folder menu option off the Product menu and try again.

Failing this, use terminal to remove the .build folder in your project's folder and do a swift package update followed by a swift build. I know of at least one swift compiler bug that means a compile that fails with swift build will succeed with swift build -c release so it could be worth trying both.

If all this fails, include more detail in your question to show the exact cause of 'will no longer build'.

  • Related