Flash3001 / iOSCharts.Xamarin

A Xamarin port by Lucas Teixeira for Charts (ios-charts) by Daniel Cohen Gindi, inspired by Philipp Jahoda
Other
68 stars 20 forks source link

Port to MacOS #40

Closed EugeneUr closed 5 years ago

EugeneUr commented 6 years ago

Hey Flash,

How much work will it take, and is it even possible, to create a macOS port? If its possible to compile this to .net standard it would be even more amazing

Long story short, i would love to create a macOS app using this API to create the charts since its a fabulous implementation.

Thank you,

EugeneUr commented 6 years ago

After doing some testing and experimenting i was able to convert iOCharts for a version fit for MacOS. Thanks for all the helpful guides you left along the way.

Flash3001 commented 6 years ago

Hey @EugeneUr,

Glad to read you've managed to do it. Last time I've checked the Charts library has a project target ready when you compile using Xcode. I'm not sure but most of the iOS ApiDefinition binding version can be reused. The SwiftLibrary will also need some work as it is not the same for iOS Devices, iOS Simulators and macOS.

Let me know if I can help with anything.

EugeneUr commented 6 years ago

Hey @Flash3001 ,

For posterity, i had to:

  1. Compile all the Swift4 projects with Xamarin.Mac and the mac .dylib. I also had to add a few more projects
  2. Compile Charts to Mac (the package packing is completely different than for iOS). Note: this was very straight forward since its a single architecture type and you don't need to run it through lipo.
  3. Modify the ApiDefinitions.cs file to switch over to the supported classes for Mac Note: it appears that VisualStudio for Mac changed its behavior a bit when it comes to linking .framework, all those configs go into the .csproj now.
  4. Added this custom afterBuild command so that the .framework can find the .dylibs in the DLL. ` install_name_tool ${TargetDir}/ChartsTest.app/Contents/MacOS/ChartsTest -add_rpath @loader_path/../Resources/Frameworks ${TargetDir}

    `

Let me know if you want me to merge my changes with yours somehow. I think it makes sense for me to push the Swift4 change upstream to your repo, so that the NuGets are comprehensive as possible. However, i am not sure about the MacCharts, i think it should be its own repo since Charts.framework structure is completely different than iOS.

EugeneUr commented 6 years ago

Hey @Flash3001 ,

One thing that would be extremely helpful is if you could please send me (or add to this project) the charts xcode project that you used to generate the ApiDefinitions.cs and Structs.cs. It appears like a bunch of folks have contributed in the recent few months so it is causing a serious headache to try and make it work for MacOS.

Thank you!

Flash3001 commented 6 years ago

@EugeneUr I believe this is the one I used: https://1drv.ms/u/s!AnlSxFnqK6ttkuVxVs0rPoMAAnf-9g (uploaded as a Zip to OneDrive).

I agree with you. It makes sense to share the same repo for Swift4, but the Nuget packages need to be separated because of the target on Nuget and the script to move files around because of the difference on Simulator and Device.

EugeneUr commented 6 years ago

Thank you so much @Flash3001, it worked perfectly! Love it when i can reuse all my iOS charts code for MacOS :)

I will work on contributing back to both project with all my finding by the end of the week so that it will super comprehensive.

sushihangover commented 5 years ago

@EugeneUr Do you have a repo that you can share with your macOS version? TIA, Sushi