Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Could not load the "img1.png" image referenced from a nib in the bundle with identifier "inatel.br.appviagens"

VIewController:

class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    // MARK: - Attributes

    var viagens: [Travel] = []

    // MARK: - @IBOutlet

    @IBOutlet weak var viewHotels: UIView?
    @IBOutlet weak var viesPackages: UIView?
    @IBOutlet weak var tableView: UITableView?

    // MARK: - Life cycle methods

    override func viewDidLoad() {
        super.viewDidLoad()
        self.tableView?.dataSource = self
        self.tableView?.delegate = self
        self.viewHotels?.layer.cornerRadius = 10
        self.viesPackages?.layer.cornerRadius = 10
        loadData()
    }

    // MARK: - Functions

    func loadData(){
        viagens = TravelDao().retornaTodasAsViagens()
    }

    // MARK: - UITableViewDataSource`

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return viagens.count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "travelCell", for: indexPath) as! TravelCellTableViewCell

        let travel = viagens[indexPath.row]

        cell.labelTitle.text = travel.name
        cell.labelValue.text = "R$ \(travel.value)"
        cell.labelDays.text = "\(travel.qtdDays) dias"
        cell.imageDetaque.image = UIImage(named: travel.imagePath)
        return cell
    }

    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 175
    }
}

TravelCellTableViewCell.swift

import UIKit

class TravelCellTableViewCell: UITableViewCell {
    @IBOutlet weak var imageDetaque: UIImageView!
    @IBOutlet weak var labelValue: UILabel!
    @IBOutlet weak var labelDays: UILabel!
    @IBOutlet weak var labelTitle: UILabel!
}

As imagens não estão sendo carregadas, dando o seguinte erro: Could not load the "img1.png" image referenced from a nib in the bundle with identifier "inatel.br.appviagens" ... isso para todas as imagens

1 resposta
solução!

Consegui resolver, na hora de jogar os arquivos tem que criar como um grupo de recursos, com a opção "Create a Folder references" marcada.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software