I'm parsing JSON data and iterating through the results and everything is just fine. But i needed a way to control the number of iteration within the loop. For instance to get the first 10 results only.
Here im parsing JSON weather data status icons. I just want to get the first 10 results and append them to the array.
if let list = arrayList["weather"] as? [[String : AnyObject]]{
for arrayList in list{
if let iconString = arrayList["icon"] as? String{
if let url = NSURL(string: "http://openweathermap.org/img/w/\(iconString).png"){
let iconImgData = NSData(contentsOfURL: url)
let image = UIImage(data: iconImgData!)
self.forcastImg.append(image!) self.forcastView.reloadData()
}
}
//print(list)
}
}
arrayList[0..<10]?