finalRestaurantArray is an array of PFObjects which contains the array CloseHours for each object. CloseHours contains the closing time for each day of the week [0-6].
How can I create an array that contains the value of CloseHours[dayOfWeek] for each object. If it is Tuesday (let dayOfWeek = 1) the array should look like:
[0015, 2350]
Current Attempt:
//create array of CloseHours
let initialCloseRestaurantHours = finalRestaurantArray.map { $0.objectForKey("CloseHours") as [String] }
//get the close hour for given day
let closeRestaurantHours = initialCloseRestaurantHours.map { $0.objectAtIndex(dayOfWeek) as String }
//Error: [string] does not have a member named objectAtIndex
Additional Info
This is the array of Objects finalRestaurantArray
[<Restaurant: 0x17411aca0, objectId: LA74J92QDA, localId: (null)> {
Name = "First One";
CloseHours = (
0005,
0015,
0025,
0035,
0045,
0055,
0065
);
}, <Restaurant: 0x17411b480, objectId: 0aKFrpKN46, localId: (null)> {
Name = "Second One";
CloseHours = (
0015,
2350,
2350,
2350,
2350,
2350,
2350
);
}]