title: SwiftUI Image not showing a UIImage from variable
body: <p>I want to display an image (type UIImage) which is stored in an EnvironmentObject. This EnvironmentObject consists of an array of a structure which holds an UIImage element.
  In a view, I want to display an image of this array but this doesn't work somehow.</p>
  <p>Here's the struct:</p>
  <pre><code>struct TestStruct: Identifiable {
      var id: String
      var name: String
      var image: UIImage
  
      init() {
          id = &quot;&quot;
          name = &quot;&quot;
          image = UIImage.init()
      }
  }
  </code></pre>
  <p>Here the ModelData class:</p>
  <pre><code>final class ModelData: ObservableObject {
      @Published var testStruct: [TestStruct] = []
  }
  </code></pre>
  <p>And this is the instantiation of modelData in the main app code:</p>
  <pre><code>struct TestApp: App {
      @ObservedObject private var modelData = ModelData()
      init() {...
  </code></pre>
  <p>The content of the modelData is loaded from a Firebase database and Firebase storage. This actually works, I can see the downloaded images in the modelData.testStruct[...].image in the debug preview.</p>
  <p>From a view, I want to reference the image from the modelData:</p>
  <pre><code>struct StructContentView: View {
      @EnvironmentObject var modelData: ModelData
  
      var body: some View {
          ScrollView {
              Image(uiImage: modelData.testStruct[0].image)
                  .frame(width: 64.0, height: 64.0)
                  .foregroundColor(.red)           
          }
      }
  }
  </code></pre>
  <p>Can someone help me? I'm generally confused with ObservableObject/EnvironmentObject and that stuff but I was able to display e.g. the field &quot;name&quot; of modelData.testStruct[0] in a TextView. Is the passing of the UIImage to the Image view wrong, maybe? Or something else needed there?</p>