-1
var savedFaouritePlaces: NSMutableArray = [] //matched strings

Here is the info I get and I want to use this items cell for row at index path

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
    {
        guard let cell = tableView.dequeueReusableCell(withIdentifier: "HeartTabCell") as? HeartTabTableViewCell else {
        return UITableViewCell()
    }

    cell.heartTabTitleLabel.text = "Wanna use that title here"
    cell.heartTabImageView.image = "wanna use that image here" 

    return cell
}
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
Mahesh
  • 41
  • 9
  • Basically never use `NSMutable...` collection types in Swift. Use native `Array / Dictionary`. – vadian Apr 10 '17 at 04:47
  • Possible duplicate of [Array from dictionary keys in swift](http://stackoverflow.com/questions/26386093/array-from-dictionary-keys-in-swift) – Mahesh Apr 10 '17 at 19:24

2 Answers2

1

You should use indexPath to retrieve each dictionary in that array:

let dict = savedFaouritePlaces[indexPath.row]

cell.heartTabTitleLabel.text = dict["Title"]
cell.heartTabImageView.image = UIImage(named: dict["Image"])
Danh Huynh
  • 2,337
  • 1
  • 15
  • 18
0
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
        let cell = tableView.dequeueReusableCell(withIdentifier: "HeartTabCell") as? HeartTabTableViewCell
        let dictionary = savedFaouritePlaces[indexPath.row]    
        cell.heartTabTitleLabel.text = dictionary["Title"]
        cell.heartTabImageView.image = UIImage(named: dictionary["Image"])
        return cell
    }
anshul king
  • 558
  • 4
  • 17
  • This fixed my issue thanks guys let dic:[String:Any] = savedFaouritePlaces[indexPath.row] as! [String : Any] print("savedFaouritePlaces: \(dic["Description"])") cell.heartTabTitleLabel.text = dic["Title"] as! String? cell.heartTabImageView.image = UIImage(named: dic["Image"] as! String) – Mahesh Apr 10 '17 at 17:06