I'm runtime errors on my existing project when migrating versions of Xcode. Can someone help with this? Is my typecasting wrong?
Code:
let x = d[ChildItem.KEY_LOOK] as! NSArray as Array
let y = d[ChildItem.KEY_COOR] as! NSArray as Array
let item = ChildItem(x as! [Float], y as! [Float])
Error:
Thread 5: Fatal error: Unable to bridge NSNumber to Float
I know how to cast an NSNumber to a Float as I found on SO (Unable to bridge NSNumber to Float in JSON parsing):
if let n = d.value(forKey: "probability") as? NSNumber {
let f = n.floatValue }
How can I do this for an NSNumber array?
In each of the d[] keys there are JSON strings like this:
d[ChildItem.KEY_LOOK] = [465918.2, 5681518.0,4462.3203]