Jpadilla1 / react-native-ios-charts

Bringing iOS Charts to React Native
MIT License
587 stars 66 forks source link

Swift 2.3 and 3.0 support ? #61

Open guitoof opened 8 years ago

guitoof commented 8 years ago

Hi there,

I updated my Xcode version to 8.0 and it asks me for a Swift conversion to 2.3 or 3.0. I have therefore updated the Charts and SwiftyJSON pods to use the 2.3 version of Swift but still have errors such as " Type 'CombinedChartView.DrawOrder' has no member 'bar'" in RNCombinedChart.swift and all other swift files in node_modules/react-native-ios-charts.

Not knowing Swift, I haven't been able to fix the errors in order to create a PR on your repo. Can you help me ? Are you maybe currently working on the conversion to support Swift's latest version ? I would love to help. Thanks for your answer

alexkendall commented 8 years ago

+1

mahlon-gumbs commented 8 years ago

@guitoof I'm using Xcode v8.0 and it would always fail on swift conversion for me as well (generating sometimes 999+ errors). I finally got it working by adding the files in step 2 rather than the group (i.e. actually select all the files in the RNiOSCharts folder rather than selecting the folder itself.

The downside is this puts all the files in the ios folder, which is a little frustrating for me since that folder is not cluttered with files.

If anyone knows how to get this working by adding the files as a group, I'm all ears. I'm sure its something simple that I'm missing.

Hope this helps.

alexkendall commented 8 years ago

I had to use CocoaPods to get it to compile.

mahlon-gumbs commented 8 years ago

@alexkendall I used CocoaPods as well. Were you able to do it with a group or are the RNiOSCharts files in your ios project root directory?

alexkendall commented 8 years ago

@mahlon-gumbs the RNiOSCharts files are in a group inside the node-modules directory. My Podfile file looks like this.

use_frameworks! target ‘FIAT_Analytics’ do pod 'SwiftyJSON', git: 'https://github.com/IBM-Swift/SwiftyJSON.git' pod 'Charts', git: 'https://github.com/danielgindi/Charts.git', branch: ‘Chart2.2.5-Swift3.0’ end

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '3.0' end end end

mahlon-gumbs commented 8 years ago

@alexkendall so for step 2 when you have to "Add files to ", how did you do it? I must have done something wrong because it copied the files from the node modules into my ios folder. i.e. when I do an ls from the command line, I can see all of the Chart files in /ios/.

I'd like to maybe pull them in as a reference or something if that's possible.

---Referring to this step in the readme---

  1. Add all the files under node_modules/react-native-ios-charts/RNiOSCharts. (In Xcode: File -> Add files to "App Name")
alexkendall commented 8 years ago

@mahlon-gumbs Yeah. I would try pulling the files in as a reference instead and make sure copy files isn't selected when you add the files to the project.

mahlon-gumbs commented 8 years ago

@alexkendall I knew it would be something silly on my part. That did it. Thanks!

L-Jovi commented 7 years ago

@mahlon-gumbs @alexkendall sorry to trouble, I also follow your idea but failed.

I notice that New major release of danielgindi/Charts have full support swift 3.0 and do some breaking changes and I wonder that whether current version of react-native-ios-charts support swift 3.0,

I set use legacy swift language version to No in build settings and ensure that swift 3.0 compiler work, and I upgrade cocoapods to latest version 1.1.1 to ensure that config.build_settings['SWIFT_VERSION'] = '3.0' work as well,

when I try to build, I encounter so many error in react-native-ios-charts files, what should I do now?

thanks for your time,

regards.

mahlon-gumbs commented 7 years ago

@L-Jovi sorry for the late response. Are you still having issues?

Unfortunately it's no longer working for me either on new builds. Seems the dependent branch has been deleted. I'll have to play around a bit to see if I can get this working again for my project.

L-Jovi commented 7 years ago

@mahlon-gumbs thanks for your reply :)

eventually I can't solve so many error and I roll back to swift 2.3 compiler support, and I'll appreciate that to be shared the branch if you successfully build the project with swift 3.0

thanks for your time,

regards.

mahlon-gumbs commented 7 years ago

@L-Jovi I followed @Aaaaaashu advice here: #65 (use the Swift-3.0 branch from a fork) and that did the trick for me.

Hope that helps you as well.

L-Jovi commented 7 years ago

@mahlon-gumbs thanks a lot :)

wuxudong commented 7 years ago

I create a new repo, merge this and another android chart lib, you may check this. https://github.com/wuxudong/react-native-charts-wrapper