I have a list of id's
173577 173581 173565 173578 173564 173571 73576 173580
I want to loop a request with each id in the correct order, but right now it comes back in random order and doesn't get through all the ids.
i also get and error at let stock = imageArray[indexPath.row]
saying indexpath out of range and i think its because it doesn't get through all the ids
let products = newArray[indexPath.row]
let id = products.id
print(id)
let url = URL(string: "https://www.supremenewyork.com/shop/\(id).json")!
let request = URLRequest(url: url)
let session = URLSession.shared
let task = session.dataTask(with: request) { (data, response, error) in
if let error = error {
print("ERROR:", error)
} else if let data = data {
do {
let response = try JSONDecoder().decode(Images.self, from: data)
self.imageArray = response.styles
print(self.imageArray)
} catch {
print(error)
}
} else {
print("UNEXPECTED ERROR")
}
}
task.resume()
let stock = imageArray[indexPath.row]
let x = stock.biggerZoomedURL
print(x)
The code is working (except let stock = imageArray[indexPath.row]
error), i just was seeing if there's a way to loop each id in and print them out in order