Saving and retrieving images with correct order

59 views Asked by At

I'm trying save some images to an array, and their name to another array as string with below code;

self.countryNamesArray.append(object["CountryName"] as! String)
let image = UIImage(data:imageData!)
self.countryImages.append(image!)

But it doesn't retrieve images with same order I saved while retrieve CountryNamesArray with correct order.

rowString = countryNamesArray[row]
myImageView.image = self.countryImages[row]

Should I use custom class to save images with string or are there any way to fix?

0

There are 0 answers