---
title: "Using old versions of Swift in Xcode"
url: "https://www.pardel.dev/2017/03/28/using-old-versions-of-swift-in-xcode"
date: 2017-03-28
author: "Paul Ardeleanu"
tags: ["Swift","Xcode"]
description: "Apple released new versions of iOS, watchOS, tvOS & MacOS yesterday, and with it came a new version of Xcode, 8.3, that only includes Swift 3.1."
---

# Using old versions of Swift in Xcode

## The problem we're trying to solve

Apple released new versions of iOS, watchOS, tvOS & MacOS yesterday, and with it came a new version of Xcode, 8.3, that only includes Swift 3.1 — the latest and greatest of Swift. This becomes a problem if you're using a 3rd party libraries in binary form.

**Example**: As I'm writing this, the current version of Realm's “Mobile Database” is 2.4.4 which comes with binaries for Swift 3.0, 3.0.1 & 3.0.2, making it unusable with the default Swift toolchain for Xcode 8.3.


## The Solution: multiple Swift toolchains

Apples makes previous Swift toolchains available for download here: [https://swift.org/download/#releases](https://swift.org/download/?ref=pardel.dev#releases).

**Example**: Swift 3.0.2 is available as part of Xcode 8.2 but also as a separate download (see the image below). Click on the (Toolchain) link to start the download.

![Old Swift in Xcode - Swift 3.0.2](/assets/images/blog/2017-03-28-using-old-versions-of-swift-in-xcode/1_swift_3_0_2.png "Swift 3.0.2")

Each toolchain is available as a .pkg archive that can be downloaded & installed— it will require system admin access to install.

![Old Swift in Xcode - Toolchain Install](/assets/images/blog/2017-03-28-using-old-versions-of-swift-in-xcode/2_toolchain_install.png "Toolchain Install")

Once that is in place and **Xcode is restarted**, a new entry will appear in the Xcode menu where the active toolchain can be chosen at will:

![Old Swift in Xcode - Xcode Toolchains](/assets/images/blog/2017-03-28-using-old-versions-of-swift-in-xcode/3_xcode_toolchains.png "Xcode Toolchains")

A new tab item will also appear under `Settings > Components: Toolchains`. You can use this to pick the active toolchain or, verify or delete installed toolchains.

![Old Swift in Xcode - Xcode Components Toolchains](/assets/images/blog/2017-03-28-using-old-versions-of-swift-in-xcode/4_xcode_components.png "Xcode Components Toolchains")

> NB: The “default” toolchain that came with Xcode can't be removed. Also, deleting all the extra toolchains will cause the Toolchains tab item, as well as the menu entry, to dissapear.

### That's all folks!
