title: Trouble saving selected images from phpickerviewcontroller
body: <p>Here's my code</p>
  <pre><code>func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
      picker.dismiss(animated: true, completion: nil)
      let imgName : String = UUID.init().uuidString
      
      guard let itemProvider = results.first?.itemProvider else { return }
      if itemProvider.canLoadObject(ofClass: UIImage.self) {
          for result in results {
              result.itemProvider.loadObject(ofClass: UIImage.self, completionHandler: { (image, error) in
                  
                  if let newImage = image as? UIImage {
                      DispatchQueue.main.async { [self] in
                          let newImgInfo = MediaHandler.saveImg(albumName: albumName, imgUrl: imgName)
                          self.imageArray.append(newImage)
                          print(self.imageArray.count)
                          self.imageDataArray.append(newImgInfo)
                          DataHandler.saveImgData(imageName: imgName, image: newImage)
                          self.collectionView.reloadData()
                         }
                     }
                  else {
                      print(&quot;wrong&quot;)
                  }
              })
          }
      }
      self.collectionView.reloadData()
  }
  </code></pre>
  <p>If I select one image at a time add add to the collection view it works fine, I can leave the view and come back and all is well,
  <a href="https://i.stack.imgur.com/e2lSz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e2lSz.png" alt="enter image description here" /></a>
  but if I select more than one image, when I leave the view and come back it just shows multiple copies of the same image.</p>
  <p><a href="https://i.stack.imgur.com/RcaEo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RcaEo.png" alt="enter image description here" /></a></p>
  <p>Any clues as to why would be appreciated. I might ad that if I use a UIImagePicker everything works fine. I'm just wanting to allow multiple selection with the image picker.</p>