title: SwiftUI - Display an array of Image
body: <p>I'm using Apple's VisionKit and storing the images in both an <code>Image</code> and <code>Data</code> array, like so:</p>
  <pre><code>@State private var image: [Image] = []
  @State var imageData : Data = .init(count: 0)
  </code></pre>
  <p>And appending the data like this:</p>
  <pre><code>for imageIndex in imagePerPage! {
    var uiImage = UIImage(cgImage: imageIndex)
    let converted = Image(uiImage: uiImage)
    image.append(converted)
    imageData.append(uiImage.jpegData(compressionQuality: 0.00005)!)
  }
  </code></pre>
  <p>I'm passing the data to another view which is fine, as I can use <code>print(image.count)</code> and I get the expected count. However, I'm having issues with iterating over my array and display the images. I use a <code>ForEach</code> statement and I get an error nagging me that the data type <code>Image</code> must conform to <code>Hashable</code> (I'm not using a model/struct)</p>
  <pre><code>@State var image: [Image]
  
   ForEach(image.count, id: \.self) { image in
    Image(image)
    .resizable()
    .frame(width: getScreen().width, height: getScreen().height * 0.85)
     .aspectRatio(contentMode: .fit)
  }
  </code></pre>
  <p>I've even tried a for loop i.e. <code>for x in images {///}</code>.</p>
  <p>Is there anyway in which I can resolve this issue?</p>
  <p>Would be much appreciated!</p>