How to use a pre-release Swift version in Xcode

⋅ 2 min read ⋅ Xcode

Table of Contents

Each Xcode version comes with a specific Swift toolchain, but you don't have to wait for a new Xcode version to try the new Swift features. This article will show you how to use Swift 5.5 snapshot in Xcode 12.5 (Xcode 12.5 comes with Swift 5.4).

Installing Alternative Swift Toolchains

You can find the newest Swift snapshots from the Official Swift website under the Download menu.

Swift 5.5 Snapshots.
Swift 5.5 Snapshots.

You will get package installer file like this.

Package installer.
Package installer.

Run the package installer and simply follow the installer steps, which will install an Xcode toolchain into /Library/Developer/Toolchains/. In this example it would install at /Library/Developer/Toolchains/swift-5.5-DEVELOPMENT-SNAPSHOT-2021-06-02-a.xctoolchain.

Choose the new toolchain in Xcode

After installing a new toolchain, we need to tell Xcode to use this new toolchain. We have two ways to do this.

Toolchains menu

You can find the Toolchains menu under Xcode menu, where you can easily switch between installed Swift toolchains.

Toolchains menu.
Toolchains menu.

Components preferences

Open Xcode’s Preferences (⌘ - command + ,), navigate to Components tab, then select Toolchains. You will see all available toolchains, select our newly installed one.

When an alternative toolchain is chosen, you will see a new toolchain indicator in Xcode's toolbar. Click indicator icon will open up Components preferences, where you can change back to the default one.

Toolchain indicator.
Toolchain indicator.

Xcode uses the selected toolchain for building Swift code, debugging, and even code completion and syntax coloring.

Caveat

Selecting a Swift toolchain in Xcode will affect the Xcode IDE only. It won't affect any command-line tools.

You can easily support sarunw.com by checking out this sponsor.

Uninstall

You can easily uninstall your toolchain in the Toolchains tab under Components preferences.

  1. Open Xcode’s Preferences (⌘ - command + ,), navigate to Components tab, then select Toolchains. You will see all available toolchains.
  2. Hover your mouse over the one you want to uninstall, and you will see a cog icon appear.
  3. Select "Move to Trash".

You can also manually delete it from /Library/Developer/Toolchains/.


Read more article about Xcode or see all available topic

Enjoy the read?

If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you'll get a quick recap of all articles and tips posted on this site. No strings attached. Unsubscribe anytime.

Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.

If you enjoy my writing, please check out my Patreon https://www.patreon.com/sarunw and become my supporter. Sharing the article is also greatly appreciated.

Become a patron Buy me a coffee Tweet Share
Previous
Pull to refresh in SwiftUI with refreshable

SwiftUI got a native way to add UIRefreshControl in iOS 15. Let's find out how to add it in the list view and even your custom view.

Next
A new way to style UIButton with UIButton.Configuration in iOS 15

The first part in the series "What's new in UIKit button". An introduction to a new button configuration, a struct that is shaping and styling your button. You no longer need to subclass UIButton ever again with button configuration.

← Home