This is the function I am using:
let values = (0..<self.data.count).map { (i) -> ChartDataEntry in
let x = valueDate!.timeIntervalSince(startDate)
if let a = (self.data[i]["labelvalue"] as? NSString)?.doubleValue{
return ChartDataEntry(x: Double(x), y: a)
} else {
return nil
}
}
This is causing this error:
Nil is incompatible with return type 'ChartDataEntry'
How can I skip the loop without returning any value and continue with next check?