I did post request for retrieving data from the server. Now, I have NSDictionary with certain data. I need to display it in a chart, so I have to convert data to appropriate. Here's data which I get from the server:
dates = (
"01.01.2016",
"01.01.2016",
"01.01.2016"
...)
closes = {
0 = (
1,
1,
1,
...)
}
I need to transform it to this format:
{
"01.01.2016" = 1;
"01.01.2016" = 1;
"01.01.2016" = 1;
...
}
How can I do this?
NSArray *dates = ...
NSArray *closes = ...
NSMutableDictionary *result = [NSMutableDictionary new];
for (int i = 0; i < dates.count; i++) {
result[dates[i]] = closes[i];
}
NSLog(@"%@", result)
Note that dates and closes arrays must have same length