2

I recently updated Xcode to version 9.0 and many errors suddenly occurred inside the Charts framework that I was using inside my app. I installed Charts iOS using Carthage and admittedly, I don't have a ton of experience with Carthage and setting the correct swift version for Charts (which is what I'm assuming the problem is).

Here are some of the things I've tried: I tried downgrading to 3.0.3 which did not help. I also tried to manually go through and 'fix' all of the bugs that were highlighted in Xcode (there were upwards of 100 in total) and I think I did more damage than good. Most of the bugs were in relation to a dictionary type mismatch: NSAttributedStringKey : Any and String : AnyObject

Now, my app crashes every time I try to display a Chart. Could someone please give me a recommendation on what I should do? Remove the Charts framework completely and reinstall (using Carthage)?

Cœur
  • 37,241
  • 25
  • 195
  • 267
M. Black
  • 353
  • 1
  • 4
  • 20

2 Answers2

2

Here is what I suggest looking at first

  1. The Swift Version setting of Charts is set to Swift 4.
  2. If you have a .swift-version file under your project, make sure the content of it is "4.0".
  3. Try to clean your project.

If you go to the project navigator and click you project. Under targets, select the target you want to modify. Click build settings for that target. Under Swift Compiler - Language, change swift language version to swift 4.0. Clean and restart xcode

In your pod file, make sure that each target is using the correct swift language version.

See this screenshot for the charts sample project - pods file

This is for the project file

Nevin
  • 190
  • 2
  • 9
1

At the moment,

pod 'Charts'

downloads version 3.0.2 which is not ready for Swift 4

to get 3.0.4 which is ready for Swift 4 do

pod 'Charts', :git => 'https://github.com/danielgindi/Charts/', commit: '54171609c2f7d987a46eab60eb0422318d08d266'

in your Podfile, as described in this issue: https://github.com/danielgindi/Charts/issues/2814

I hope this Answer is outdated soon

Gerd Castan
  • 6,275
  • 3
  • 44
  • 89