0

I have this array of names as below

["Acting Chief Justice Gita Mittal", "Justice S. Ravindra Bhat", "Justice Sanjiv Khanna", "Justice G. S. Sistani", "Justice Dr. S. Muralidhar", "Justice Hima Kohli", "Justice Vipin Sanghi", "Justice Siddharth Mridul", "Justice Manmohan"]

and Array of URLs as below

["writereaddata%5Cupload%5CJudges/JImage_7ZV0X5SB.JPG", "writereaddata%5Cupload%5CJudges/JImage_31PR55RK.JPG", "writereaddata%5Cupload%5CJudges/JImage_TALSLWYH.JPG", "writereaddata%5Cupload%5CJudges/JImage_DDW7F8I4.JPG", "writereaddata%5Cupload%5CJudges/JImage_8MP3TXZ2.JPG", "writereaddata%5Cupload%5CJudges/JImage_3R72I03Q.JPG", "writereaddata%5Cupload%5CJudges/JImage_ZPL72GGF.JPG", "writereaddata%5Cupload%5CJudges/JImage_RHXYPY1N.JPG", "writereaddata%5Cupload%5CJudges/JImage_BR82DUAU.JPG"]  

I want to display these in collection view in swift on runtime on image and label . How to do this ?

Thanks

Jino Shaji
  • 1,097
  • 14
  • 27
Angad Singh
  • 59
  • 1
  • 1
  • 5

2 Answers2

1

There is a great swift library for downloading and caching images called SDWebImage. Check the docs it's pretty straightforward.

Aditya Srivastava
  • 2,630
  • 2
  • 13
  • 23
Ivan
  • 264
  • 3
  • 14
1

You can SDWebImage library to load image from URL in TableView and CollectionView.

You like this in UITableView and UICollectionView cell.

cell.imageView.sd_setImage(with: URL(string: "yourImageURL"), placeholderImage: UIImage(named: "placeholder.png"))
Jaydeep Vora
  • 6,085
  • 1
  • 22
  • 40