11

I am getting this error while trying to install react-native-charts-wrapper. I have followed the steps exactly as they say but still not able to build the project successfully.

I also set the SWIFT_VERSION to 4.2 in build settings of my project, still getting the same error.

My XCODE version: Version 10.1 (10B61)

Any ideas?

honor
  • 7,378
  • 10
  • 48
  • 76
  • It looks like something has a dependency on Swift 5.0. You'll need to install the latest Xcode (10.2). – Mike M Apr 16 '19 at 14:17
  • I think it is asking me to downgrade the swift version, right? So why install the latest version of XCode? @MikeM – honor Apr 16 '19 at 14:20
  • six one way, half dozen the other...just don't know if the SwiftyJSON library needed 5.0 for something but probably not. – Mike M Apr 16 '19 at 14:51

4 Answers4

30

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.

enter image description here

Cheers

honor
  • 7,378
  • 10
  • 48
  • 76
6

For anyone who's build continues to fail despite following the previous solution:

  1. Find SWIFT_VERSION literal in whole project files using IDE or editor – I turned on sublimetext, open project root directory, [Find] - [Find in Files.] – Search SWIFT_VERSION

  2. In my case some constants in projectfile was SWIFT_VERSION = 5.0 in proj.pbxproj file despite I changed swift_version on Xcode

    <code>SWIFT_VERSION = 5.0</code> in proj.pbxproj

  3. Change value you want and save file

  4. Restart Xcode

  5. Try Build

Makyen
  • 31,849
  • 12
  • 86
  • 121
gonnichiwa
  • 61
  • 1
  • 4
3

"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)

  1. Select 'Pods' on the project tree
  2. Select a dependency from TARGETS: select one dependecy at a time then do step 3 and step 4 for each targets
  3. Make sure 'Build Settings' tab selected
  4. 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.

Shown steps to follow, marked sequentially

Community
  • 1
  • 1
AFA
  • 1,009
  • 11
  • 8
2

Use the search tab and search for SWIFT_VERSION.
A list of links to all occurrences will appear.
Clicking a link will take you to the relevant setting in the Build Settings page. Change as needed using the dropbox.

image for reference

Azametzin
  • 5,223
  • 12
  • 28
  • 46
NewToSwift
  • 21
  • 1