danielgindi/ChartsRealm

Type 'RLMArray<RLMObject>' does not conform to protocol 'Sequence'

jojonarte opened this issue · 1 comments

I'm getting this error when using ChartsRealm

func preparePieChart() {
        let results = photos?.filter(NSPredicate(format: "type == %@", "hidden"))
        let set = RealmPieDataSet(results: criticalResults, yValueField: "\(results?.count)", labelField: "Critical Deficiency")
        let data = PieChartData(dataSet: set)
        pieChartView.data = data
        pieChartView.chartDescription?.text = ""
        
        // Color
        dataSet.colors = [.purple, .red, .orange, .yellow, .green, .blue]
        //dataSet.valueColors = [UIColor.black]
        pieChartView.holeColor = UIColor.clear
        pieChartView.drawHoleEnabled = false
        pieChartView.chartDescription?.textColor = UIColor.black
        pieChartView.legend.textColor = UIColor.black
        
        pieChartView.chartDescription?.xOffset = pieChartView.frame.width
        pieChartView.chartDescription?.yOffset = pieChartView.frame.height * (2/3)
        pieChartView.chartDescription?.textAlign = NSTextAlignment.left
        
        pieChartView.drawEntryLabelsEnabled = false
        
        let legend = pieChartView.legend
        legend.wordWrapEnabled = true
        legend.horizontalAlignment = .center
        legend.verticalAlignment = .bottom
        legend.orientation = .horizontal
        legend.drawInside = false
        legend.enabled = true
        pieChartView.animate(xAxisDuration: 2.0, yAxisDuration: 2.0)
        //        pieChart.xAxis.labelPosition = .top
        // Refresh chart with new data
        pieChartView.notifyDataSetChanged()
    }

you need to copy RLMSupport.swift file