acompanhei paso a paso a aula mas no meu app nao carrega as imagens, a única diferença que eu saiba, é que estou usando o Xcode 12.4..
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var tabelaviagens: UITableView!
@IBOutlet weak var viewHoteis: UIView!
@IBOutlet weak var viewPacotes: UIView!
let listaViagens: Array<Viagem> = ViagemDAO().retornaTodasAsViagens()
override func viewDidLoad() {
super.viewDidLoad()
self.tabelaviagens.dataSource = self
self.tabelaviagens.delegate = self
self.viewHoteis.layer.cornerRadius = 10
self.viewPacotes.layer.cornerRadius = 10
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return listaViagens.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! TableViewCell
let viagemAtual = listaViagens[indexPath.row]
cell.labelTitulo.text = viagemAtual.titulo
cell.labelQuantidadeDias.text = "\(viagemAtual.quantidadeDeDias) dias"
cell.labelPreco.text = viagemAtual.preco
cell.imagemViagem.image = UIImage(named: viagemAtual.caminhoDaImagem)
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 175
}
}