I've been racking my brain for hours and feel like I've tried most things so I'm turning to the trusty Stack Overflow!
I have an array of arrays coming from a server that correlates to a unix timestamp and a value which looks like this:
[[1475511843000,183649999],[1475512143000,183612691],[1475512443000,183503638]]
I used to simply set this variable up as
var graphPoints:NSArray = []
I'm now trying to convert to Swift3 and use [[UInt32:Int]]() to specify that I have an array containing other arrays which have a 32 Unsigned Integer as well as an Integer afterwards. No matter which way I've tried including standard vs. sugared syntax:
[Int:[UInt32:Int]]()
[[UInt32:Int]]()
[[]]()
allows me to access the second array due to a typing issue, normally giving an error akin to Type 'Int?' has no subscript members.
The data was in this format before I had a say as to how it would be formatted so I'm not able to adjust that, any help would be great appreciated.
The server call looks like this: `Alamofire.request(urlString).responseJSON { response in switch response.result { case .success(let data): let json = JSON(data);
//print("GRAPH DATA POINTS JSON: \(json)")
//some graphs don't contain data so we have to test for null
if !json.isEmpty {
self.graphPoints = json["data"].arrayObject! as! [(timestamp: UInt64, value: Int)]
if self.graphPoints.count > 0 {
self.firstPriceInGraph = self.graphPoints[0][0].doubleValue
self.setupPercentageLabel()
} else {
//no graph data available, hide something?
self.firstPriceInGraph = -1.0
if Helper.__DEBUG { print("NO DATA IN JSON... 1")}
}
} else {
//no graph data available, hide something?
self.firstPriceInGraph = -1.0
if Helper.__DEBUG {print("NO DATA IN JSON... 2")}
}
self.graphView.reloadData()
case .failure(let error):
self.graphPoints = [(timestamp:UInt64, value:Int)]()
self.graphView.reloadData()
print("Get Graph Data - Request failed with error: \(error)")
}
}`



[[UInt32]]- Nirav DUInt32.UInt64is a better choice here. - Andrey GordeevgraphPointsandfirstPriceInGraph: they have wrong types - Andrey Gordeev