I'm currently using Charts with CocoaPods and I have an issue that I don't quite understand.
I created a subclass of PieChartView
and overwrote the function calcMinMax
from PieChartView
in my custom class, allowing me elsewhere to create a custom pie chart of my data.
I've changed the function in PieChartView
from internal override func calcMinMax()
to open override func calcMinMax()
, allowing me to override it in my custom class using public override func calcMinMax()
:
open class PieChartView: PieRadarChartViewBase
{
...
open override func calcMinMax()
{
calcAngles()
}
}
public class CustomPieChartView: PieChartView
{
....
public override func calcMinMax()
{
calcAngles()
}
}
In the demo application, I changed the chartView's type from PieChartView
to CustomPieChartView
, as well as updated the class type appropriately in PieChartViewController.xib
:
class PieChartViewController: DemoBaseViewController {
@IBOutlet var chartView: CustomPieChartView!
...
}
In Xcode 10.3, when the pie chart is about to be displayed, notifyDataSetChanged
is called within the class PieRadarCharViewBase
, which calls calcMinMax
, and as a result calls the overridden calcMinMax
in my custom class CustomPieChartView
. This works as expected.
FYI: PieChartView
is a subclass of PieRadarCharViewBase
.
The stack is shown in Xcode 10.3 working correctly:
The problem is, migrating to Xcode 11, without updating any code breaks this functionality, and instead of calling CustomPieChartView::calcMinMax
, calls the parent class PieChartView::calcMinMax
, leading to a crash (irrelevant to the original issue).
The stack is shown in Xcode 11 working incorrectly:
I've attached the demo app containing the issue to better visualize and replicate my issue.
I simply cannot figure out what is causing this issue. I've tried to raise an issue in the library's repo, but have not received any responses: drawAngles[j] crash in PieChartRenderer using custom PieChartView in Xcode 11+
Does anyone know what is causing this, after running my demo app? demo app
It's best to run the demo using Xcode 10.3 and Xcode 11 to see the difference.