SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'SwiftyJSON')
I found it. I am not familiar with XCode so it was not very straightforward for me. I clicked "Pods" on the project tree on the left, then clicked the dropdown to select SwiftyJSON from the list at the top left corner. Then changed the Swift version which was set to 5.0. See the image.
Cheers
For anyone who's build continues to fail despite following the previous solution:
Find
SWIFT_VERSION
literal in whole project files using IDE or editor – I turned on sublimetext, open project root directory, [Find] - [Find in Files.] – SearchSWIFT_VERSION
In my case some constants in projectfile was
SWIFT_VERSION = 5.0
in proj.pbxproj file despite I changed swift_version on XcodeChange value you want and save file
Restart Xcode
Try Build
"Normally this error comes from the pods(dependencies like Alamofire, SwiftyJSON ets) you have installed."
To solve the problem, follow these steps:
(See the image below for illustration)
- Select 'Pods' on the project tree
- Select a dependency from TARGETS: select one dependecy at a time then do step 3 and step 4 for each targets
- Make sure 'Build Settings' tab selected
- Scroll up and down and find out 'Swift Language Version'. Select a version, for example 'Swift 4.2'
If you have multiple dependency installed, you have to set 'Swift Language Version' for each of them. (look at the image, this project have 2 dependencies: Alamofire and SwiftyJSON, so I have done 2 times step 2 to step 4)
Restart Xcode then build
hope the error gone.