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.
Launch Xcode and open your project.
Select your project in the Project Navigator, then choose your target. Navigate to the "Build Settings" tab.
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.
Open the Terminal app on your Mac.
Ensure that Terminal is pointing to the correct version of Xcode by executing:
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
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.