I am developing a small application. I've been searching for days but couldn't find a suitable answer for myself. The API I use has a png path that comes as a string. I want to show this in imageView. Can anyone help?
My model class is as follows:
import Foundation
struct BooksModel: Codable {
let data: [Book]
enum CodingKeys: String, CodingKey {
case data
}
}
struct Book: Codable {
let _id: Int
let name: String
let imageUrl: String
}
I want to show inside Cell:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = Bundle.main.loadNibNamed("CustomCell", owner: self, options: nil)?.first as! CustomCell
if filteredBook.isEmpty {
cell.bookTitle.text = contents[indexPath.row].name
} else {
cell.bookTitle.text = filteredBook[indexPath.row].name
}
//cell.bookImage.image = UIImage(named: contents[indexPath.row].imageUrl)
return cell
}