无法将类型 'UIImage' 的值分配给类型 'UIImageView'

Cannot assign value of type 'UIImage' to type 'UIImageView'

我正在做一个简单的性格测验,它会根据结果在我的主故事板上的 ImageView 中显示特定图像。在 QuestionData.Swift 中,我使用了以下 switch 语句:

var image: UIImage { //personality image
   switch self { //Checking what answer it matches to
   case .open: return UIImage(named: "football.jpg")!
   case .conscience: return UIImage(named: "football.jpg")!
   case .extra: return UIImage(named: "football.jpg")!
   case .agree: return UIImage(named: "football.jpg")!
   case .neuro: return UIImage(named: "football.png")! //for testing purposes all images are the same
    }

}

在我的 ResultsViewController 中:

 @IBOutlet weak var resultsImage: UIImageView!

//function code goes here

            resultsImage = mostCommonAnswer.image //matches image to personality result

我收到错误“无法将类型 'UIImage' 的值分配给类型 'UIImageView'”

有什么解决办法吗?

您需要将图像设置为 UIImage 属性 of UIImageView

resultsImage.image = mostCommonAnswer.image