Search code examples
iosswiftios-charts

Swift: Cannot assign a value of type [CombinedChartView.DrawOrder] to a value of [int]


I am using https://github.com/danielgindi/ios-charts/ I had implement delegate: ChartViewDelegate

Code:

chartView.drawOrder = [CombinedChartView.DrawOrder.Bar, CombinedChartView.DrawOrder.Line]

but I have this error:

Cannot assign a value of type [CombinedChartView.DrawOrder] to a value of [int]

I am able to use drawOrder in Obj-C but not in Swift for the same code. Is there a way to solve this?


Solution

  • Try:

    chartView.drawOrder = 
        [
            CombinedChartView.DrawOrder.Bar.rawValue, 
            CombinedChartView.DrawOrder.Line.rawValue
        ]