title: fetch binary data to a index array in swift
body: <p>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. </p>
  
  <p><a href="https://i.stack.imgur.com/Amwi2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Amwi2.png" alt="enter image description here"></a></p>
  
  <pre><code>  class ViewController: UIViewController{
     var piczy = [UIImage]()
      func fetch()
      {
  
            for i in 0..&lt;piczy.count {
              let newUser = Users(context: context)
              newUser.image = piczy[i]
              newUser.idxPic = Int32(i + 1)
  
          }
    }}
  </code></pre>