1

I have error in my Xcode :

enter image description here

SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2.(in target 'SwiftyJSON')
 SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'Eureka')
SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'XLPagerTabStrip')

I found that I should upgrade my swift language version , but when i update this error is shown:

enter image description here enter image description here

This is my podfile content :

platform :ios, '12.1'

target 'Questers' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Questers

pod 'SwiftyJSON'
pod 'TextFieldEffects'
pod 'Alamofire'
pod 'XLPagerTabStrip'
pod 'Eureka' 
pod 'Charts'
pod 'Floaty'
pod 'SVProgressHUD'
pod 'iOSDropDown'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
pod 'MessageKit'
pod 'MessageInputBar'

    target 'QuestersUITests' do
    inherit! :search_paths
    pod 'Firebase'
end

end

Angel F Syrus
  • 1,984
  • 8
  • 23
  • 43
Raghad ak
  • 15
  • 5
  • You should never manually modify pods, including updating the used Swift version. Wait for the pods to be updated to Swift 5 by their maintainers or [specify the Swift compiler version to use for each pod](https://stackoverflow.com/questions/40501440/how-to-set-the-legacy-swift-version-for-each-pod-in-podfile-xcode-9-0-swift-3-2) in your podfile. – Dávid Pásztor Apr 03 '19 at 10:13

2 Answers2

1

The error clearly says the Swift compiler version 5.0 is set for SwiftyJSON, 'Eureka', 'XLPagerTabStrip' pods.

Solution 1:

Simply

  1. Select the Pods project from your workspace
  2. Select the above mentioned pod from the project target.
  3. Under build setting search for Swift Language Version and update it to 3.0, 4.0 or 4.2.

Repeat step 2-3 for all 3 pod targets.

Set the pod specific configuration to the podfile.

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == 'Material'
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '4.2'
            end
        end
    end
end

Solution 2:

If the pods are using Swift 5.0 language feature in that case above solution won't work. So, update your XCode to version 10.2 that contains the Swift 5.0 APIs. Or manually download the toolchain from Swift 5.0

Prateek Pande
  • 495
  • 3
  • 12
  • 1
    Don't do that. Never modify a pod manually, since any modifications will break when you update your pods. Cocoapods supports specifying different Swift compiler versions for each pod in the podfile, so leverage that feature instead. – Dávid Pásztor Apr 03 '19 at 10:14
  • @DávidPásztor you are right. You can add a specification to the podfile itself, If you are following Solution 1. **I have updated the answer** – Prateek Pande Apr 04 '19 at 09:57
0

Update Your Xcode to 10.2 or manually set versions in pod as following

pod 'Eureka',  '~> 4.3.1'

When you keep pod in podfile, cocoapods installs latest version of the library. In your case, the latest version is written in Swift 5, but your xcode does not support Swift 5, you must set the pod version for installing lib with the supported version of swift.