My swift code below is trying to fetch a numbered core data binary array. I am getting the error Cannot assign value of type 'UIImage' to type 'Data?' at piczy[I].This code works if I take the core data from a string but doing this with a image it does not work and causes a compile error. Users is the name of core data entity.
class ViewController: UIViewController{
var piczy = [UIImage]()
func fetch()
{
for i in 0..<piczy.count {
let newUser = Users(context: context)
newUser.image = piczy[i]
newUser.idxPic = Int32(i + 1)
}
}}