This question is related to this answered question
fatal error: NSArray element failed to match the Swift Array Element type
but with an additional problem.
I'm trying to parse some JSON input and have the following two classes
class EndDiskMeridian:NSObject {
var dispUcoefficients:Array<Double>
var dispVcoefficients:Array<Double>
var dispWcoefficients:Array<Double>
init(dict: NSDictionary) {
dispUcoefficients = dict["DispUcoefficients"] as Array<Double>
dispVcoefficients = dict["DispVcoefficients"] as Array<Double>
dispWcoefficients = dict["DispWcoefficients"] as Array<Double>
}
}
class EndDisk:NSObject {
var numberOfDivisions:Int!
var meridians:Array<EndDiskMeridian>!
init(dict:NSDictionary) {
numberOfDivisions = dict["numberOfDivisions"] as Int
meridians = dict["meridians"] as Array<EndDiskMeridian>
}
}
The problem is when I am adding the EndDiskMeridians from the dict it is never getting to the init function in the EndDiskMeridian class.
When I go to access the dispUcoefficients I get the "fatal error nsarray element failed to match the swift array element type" error at run time.
How should I be setting up the meridians when they contain an arrays of doubles?