So in Swift2.x, below code works without issues:
define:
public class BarChartData
public convenience init(xVals: [String?]?)
{
self.init(xVals: xVals, dataSets: [IChartDataSet]())
}
public convenience init(xVals: [NSObject]?)
{
self.init(xVals: xVals, dataSets: [IChartDataSet]())
}
init:
let xs = Array(1..<10).map { return Double($0) }
let data = BarChartData(xVals: xs)
However in Swift3, Xcode8 GM throws me error:
Cannot invoke initializer for type 'BarChartData' with an argument list of type '(xVals: [Double])'
If I change to
let data = BarChartData(xVals: xs.map { i in return i as NSObject })
Then it will work.
It seems in Swift3, the bridge between [Double] and [NSObject] is gone. Is there any documentation about this change or it's a bug?