I have a collection view controller, which load image Async by URL. (Something like Instegram) I am looking for the best way to implement the part of the loading image. plea
You can download image by using responseData(queue:completionHandler:)
SWIFT 4
func downloadImages(imageURL: String) {
Alamofire.request(imageURL, method: .get)
.validate()
.responseData(completionHandler: { (responseData) in
self.yourImageVIew.image = UIImage(data: responseData.data!)
DispatchQueue.main.async {
// Refresh you views
}
})
}