I have been working on finding the source of this error for many hours and am unable to do so. The error appears after I try to select the first value from a pickerview with a button. I am working with the Charts 3.0 pod. I have included the function below.
func barChartUpdate() {
var dataEntries: [BarChartDataEntry] = []
let moodRatings = getRatingsFromDatabase()
for i in 0..<moodRatings.count {
let dataEntry = BarChartDataEntry(x: Double(i), y: Double(moodRatings[i].rating))
dataEntries.append(dataEntry)
}
let chartDataSet = BarChartDataSet(values: dataEntries, label: "Mood Ratings")
do{
let chartData = BarChartData(dataSet: chartDataSet)
barChartView.data = chartData //Error occurs here
} catch{
print("error")
}
}