When I\'m populating new data in my tableView Controller, my top cell is being rewrite by the bottom one. Let me explain. I have one image that is loading async in the late
I think the issue is that while you are scrolling, your images are still in downloading process (that's why you have a nil on that particular line of code). So you have to wait for it.
I am guessing that you have an array of images. If you don't, then you must make one. You must use it like so:
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrayThatcontainsShopImages.count
}
Note: that every time you add downloaded image to this array, you should call tableView.reloadData()
Using SDWebImage can be far superior. Look at the following code using this library, you just create an instance of UIImageView. then using this library, you can download image directy to imageview instance, and to access the image, you can use imageView.image property of UIImageView class
let imageView = UIImageView()
imageView.sd_setImageWithURL(someURL, placeholderImage: UIImage())
self.arrayOfImageViews.append(imageView)