Skip to content
DeveloperMemos

Checking Swift Version in Xcode and Terminal

Swift, Xcode, Terminal1 min read

Knowing the version of Swift you are using in your Xcode project is crucial for compatibility and debugging. This guide will show you how to find out the Swift version in Xcode and using the Terminal.

Prerequisites

  • Xcode installed on your Mac.
  • Basic familiarity with Terminal.

Method 1: Using Xcode

Step 1: Open Your Project

Launch Xcode and open your project.

Step 2: Navigate to Build Settings

Select your project in the Project Navigator, then choose your target. Navigate to the "Build Settings" tab.

Step 3: Check Swift Version

Scroll down or search for "Swift Compiler - Language" in the Build Settings. Here, you will find the "Swift Language Version" setting, showing the version used in your project.

XCode Settings

Method 2: Using Terminal

Step 1: Open Terminal

Open the Terminal app on your Mac.

Step 2: Check Xcode Path

Ensure that Terminal is pointing to the correct version of Xcode by executing:

1xcode-select -p

This command shows the path of the Xcode being used. If it's not the correct version, change it using:

1sudo xcode-select -s /path/to/Xcode.app

Step 3: Check Swift Version

To find out the Swift version, type the following command:

1xcrun swift -version

This command will display the version of Swift associated with the Xcode that Terminal is using.

Terminal