Search code examples
iosswiftxcodecore-datauikit

Cannot assign value type 'Data?' to type 'UIImage?'


Im trying to pass data from viewcontroller to be displayed in secondviewcontroller. Im a beginner and need help as i have been able pass string and show display the data.

P.S im currently an intern (Wfh) with no seniors that has coding experience and in need of help. Im learning on the job and im stuck here for days.

SecondViewController

Core data entity and attributes

ViewController Segue


Solution

  • if let data = selectedNode?.image {
        imageView.image = UIImage(data: data)
    }