Using SwiftyJSON I loaded a JSON array with the following structure.
[
{
"x": 2,
"y": 2,
"r": 100,
"description": {"name":"bob","institution":"NYU","technologies":[]}
},
{
"x": 4,
"y": 4,
"r": 200,
"description": {"name":"bob","institution":"NYU","technologies":[]} },...
]
Problem
I want to create an object from each element in this array.
My approach
let chartPoints: [ChartPointBubble] = json.array.map{
ChartPointBubble(x: ChartAxisValueFloat(CGFloat($0.x), labelSettings:labelSettings),
y:ChartAxisValueFloat(CGFloat($0.y)), diameterScalar: $0.r, description: $0.description)
}
The error
Cannot invoke map with an argument of list type ((_) -> _)