I already am able to fetch the url from the Api which is in Json format. But this one is the image url. now how can I able to download that image from url and show in collection view. I have
code
override func viewDidLoad() {
super.viewDidLoad()
Alamofire.request(.GET, "http://\(platform).eposapi.co.uk/?app_id=\(apiID)&app_key=\(apikey)&request=&request=gallery", parameters: nil)
.responseJSON { response in
print(response.request) // original URL request
print(response.response) // URL response
print(response.data) // server data
print(response.result) // result of response serialization
if let JSON = response.result.value {
print("JSON: \(JSON)")
self.imageData = JSON as! Array<AnyObject>
print(self.imageData)
print("total number of images = \(self.imageData.count)")
for image in self.imageData{
print(image)
}
}
In JSON
all the image url are coming . I can see it. Now how to download image from that url and show in collection view. Please tell anyone how can I apply here.
The image url I got is:
[http://chicoshorwich.com/img/14517241531454.jpg,
http://chicoshorwich.com/img/14517241944082.jpg, http://chicoshorwich.com/img/14517273984235.jpg, http://chicoshorwich.com/img/14517274885779.jpg, http://chicoshorwich.com/img/1451727556453.jpg, http://chicoshorwich.com/img/14614027267627.jpg, http://chicoshorwich.com/img/14517278515475.jpg, http://chicoshorwich.com/img/14614068518289.jpg, http://chicoshorwich.com/img/14616123258824.jpg, http://chicoshorwich.com/img/14614027528137.jpg, http://chicoshorwich.com/img/14517344227700.jpg, http://chicoshorwich.com/img/1461402768681.jpg, http://chicoshorwich.com/img/14614028323203.jpg, http://chicoshorwich.com/img/14614029485351.jpg, http://chicoshorwich.com/img/14614029565341.jpg, http://chicoshorwich.com/img/14614068296679.jpg] total number of images = 16
Please tell the solution.