beto-rodriguez / LiveCharts2

Simple, flexible, interactive & powerful charts, maps and gauges for .Net, LiveCharts2 can now practically run everywhere Maui, Uno Platform, Blazor-wasm, WPF, WinForms, Xamarin, Avalonia, WinUI, UWP.
https://livecharts.dev
MIT License
4.36k stars 569 forks source link

Touch gestures not working on iOS #1684

Open albyrock87 opened 2 weeks ago

albyrock87 commented 2 weeks ago

Describe the bug Create an MAUI app, install the package 2.0.0-rc4.5, include the CartesianChart basic example in the main page. Start the app on iOS (simulator or device). See that touch gestures are not working (i.e. tooltip not showing / zoom not working).

Expected behavior Tooltip should show

Smartphone (please complete the following information):

Additional context

To solve the problem I've added this at the top of MauiProgram builder method:

_ = typeof(LiveChartsCore.Behaviours.ChartBehaviour).GetProperties();

Why? Because from the debugger I saw that entering with F11 into contentView.AddGestureRecognizer(GetMacCatalystLongPress(contentView)); was only hitting AddGestureRecognizer and not GetMacCatalystLongPress which oddly was the only unrecognized symbol by the debugger.

So I thought...

Maybe the symbol was somehow messed up by the linker

And that's why I've tried (succesfully) this trick.

Please note that if I check out LiveCharts2 repo and try out the sample app, everything works. Also, if I reference the source project from my app (instead of the NuGet package) everything works.

So maybe it's a packaging issue.. I don't really now.

One other interesting thing, from Rider pressing GoToDefinition on ChartBehaviour only suggests .NET Standard and Android version while iOS does not show up.

I hope this helps :)

Thanks for this awesome library!

albyrock87 commented 1 week ago

Despite what I've thought.. it's still not working in sub-pages inside Shell. Honestly idk why.

albyrock87 commented 1 week ago

image Methods appear to be there.

But gesture recognizes are not. image