PFFobject(image) segue problem [SOLVED]

Hi guys ,Tableview is working but when I segue data labels ok but image can’t convert**

ViewController
``
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) → UITableViewCell {

      let cell = tableView.dequeueReusableCell(withIdentifier: "hucrem", for: indexPath) as? TableViewCellim
    
    cell?.baslikLabel.text = postDizisi[indexPath.row].baslik
    cell?.detayLabel.text = postDizisi[indexPath.row].detay
    postDizisi[indexPath.row].resim.getDataInBackground { data, error in
        if error == nil {
            if let data = data {
                cell?.imageViewim.image = UIImage(data: data)
        }
        }
    }
    return cell!
    
    
    
  }

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    performSegue(withIdentifier: "toDetay", sender: indexPath.row)
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "toDetay" {
        if let indexpath = viewControllerim.indexPathForSelectedRow {
            let desti = segue.destination as! jsonController
            desti.baslik = postDizisi[indexpath.row].baslik
            desti.detay = postDizisi[indexpath.row].detay
            desti.resim = postDizisi[indexpath.row].resim
            
            
        }
    }
    
    
   
    
}

}


**jsonController.swift**

var baslik:String?
var detay:String?
var resim:PFFileObject?

@IBOutlet weak var baslikLabel: UILabel!
@IBOutlet weak var resimView: UIImageView!
@IBOutlet weak var detayLabel: UILabel!






override func viewDidLoad() {
    super.viewDidLoad()

    baslikLabel.text = baslik
    detayLabel.text = detay
    resimView.image = resim
   
}

}

You need to convert from PFFileObject to UIImage: ios - How to convert an PFFile to an UIImage with swift? - Stack Overflow

already converted first control view and working . but I can’t segue image data , jsoncontroller.swift can not assign ‘var resim’

in resimView.image = resim you are setting resim (which is a PFFile) to esimView.image (which is expecting a UIImage. That’s the problem.

Can you switch the tag to iOS SDK, the ParseSwift SDK is a different SDK from the one you are asking about.

1 Like

problem solved thanks everyone

import UIKit
import Parse



class jsonController: UIViewController {
    var baslik:String?
    var detay:String?
    var resim:PFFileObject?
    
    @IBOutlet weak var baslikLabel: UILabel!
    @IBOutlet weak var resimView: UIImageView!
    @IBOutlet weak var detayLabel: UILabel!
    
    
    
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

        baslikLabel.text = baslik
        detayLabel.text = detay
         let resim = resim?.getDataInBackground(block: { data, error in
            if error == nil {
                let image = UIImage(data: data!)
                self.resimView.image = image
                
            }
        }
        )
       
       
       
    }