title: SwiftUI: loading images with .fileImporter
body: <p>Goal is to load 2 different images (image 1 and 2) with the new .fileImporter modifier.</p>
  <p>Problem is I get the same image loaded to both thumbnails (image 1 and 2).</p>
  <p>Have anyone managed to do that with .fileImporter modifier?</p>
  <pre><code>import SwiftUI
  
  struct ContentView: View {
      
      @State var openFile = false
      @State var img1 = UIImage()
      @State var img2 = UIImage()
  
      @State var fileName = &quot;&quot;
  
      
      var body: some View {
      
  
          Form {
              
              //image 1
              Button(action: {
                  self.openFile.toggle()
              }){
                  
                  Image(uiImage: self.img1)
                  .renderingMode(.original)
                  .resizable()
                  .frame(width: 48, height: 48)
                  .clipShape(Circle())
              }
              
              //image 2
              Button(action: {
                  self.openFile.toggle()
              }){
                  
                  Image(uiImage: self.img2)
                  .renderingMode(.original)
                  .resizable()
                  .frame(width: 48, height: 48)
                  .clipShape(Circle())
              }
              
  
          }
          
          .navigationTitle(&quot;File Importer&quot;)
  
  
          //file importer
          .fileImporter(isPresented: $openFile, allowedContentTypes: [.image]) { (res) in
              
  
              
              do{
                  let fileUrl = try res.get()
                  print(fileUrl)
                  
                  self.fileName = fileUrl.lastPathComponent
  
                  fileUrl.startAccessingSecurityScopedResource()
                  if let imageData = try? Data(contentsOf: fileUrl),
                  let image = UIImage(data: imageData) {
                      self.img1 = image
                      self.img2 = image
  
  
                  }
  
                  fileUrl.stopAccessingSecurityScopedResource()
                  
              } catch{
                  
                  print (&quot;error reading&quot;)
                  print (error.localizedDescription)
              }
              
          }
          
      }
  }
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          ContentView()
      }
  }
  </code></pre>