I am trying to save 2 uiimages together then put the combined image and have it equal a image view named finalImage. However I am getting the error message that I have assign the title my question. Just looking to put the combined uiimage in a image view.
@IBOutlet var finalImage: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
let bottomImage:UIImage = UIImage(named: "pic")!
let topImage:UIImage = UIImage(named:"wall")!
// Change here the new image size if you want
let newSize = CGSize(width: bottomImage.size.width, height: bottomImage.size.height)
UIGraphicsBeginImageContextWithOptions(newSize, false, bottomImage.scale)
bottomImage.draw(in: CGRect(x: 0,y: 0,width: newSize.width,height: newSize.height))
topImage.draw(in: CGRect(x: 0,y: 0,width: newSize.width,height: newSize.height), blendMode:CGBlendMode.normal, alpha:1.0)
let newImage:UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
//error line
finalImage.image = newImage.images
}
your newImage is UIImage, so put
finalImage.image = newImage
because, you have UIImage
type, not [UIImage]
- array of UIImage objects, in finalImage.image