title: How can we get images' URLs from Photo Album with Swift 5
body: <p>I am using following code to get videos' URLs from photo albums of iPhone.
  Then I can open whichever I want in app but
  I could not find similar way to do it for images. :(</p>
  <pre><code>var videoList: [String] = []
  var videoListURL: [NSURL] = []
  
  // Gets all the video file list from phone library
  func fetchAllVideos() {
      videoListURL.removeAll()
      videoList.removeAll()
      let fetchOptions = PHFetchOptions()
      
      fetchOptions.predicate = NSPredicate(format: &quot;mediaType = %d &quot;, PHAssetMediaType.video.rawValue )
      
      let allVideo = PHAsset.fetchAssets(with: .video, options: fetchOptions)
      
      allVideo.enumerateObjects { (asset, index, bool) in
          
          let imageManager = PHCachingImageManager()
          let options = PHVideoRequestOptions()
          options.isNetworkAccessAllowed = false
          imageManager.requestAVAsset(forVideo: asset,
                                      options: options,
                                      resultHandler: { [self]  (video, audioMix, info) in
                                        
                                          guard  let video2 = video as? AVURLAsset
                                          else {return}
                                          
                                          
                                          let urlVideo = video2.url
                                          
                                          videoListURL.append(urlVideo as NSURL)
                                          var names = urlVideo.lastPathComponent
                                          if names.contains(&quot;MOV&quot;) {
                                              names.removeLast(4)
                                              self.videoList.append(names)
                                          }
                                          
                                         
                                      })
        
          
      }
  } 
  </code></pre>