title: Swift3: Displaying Video in Collection View
body: <p>I'm relatively new to Swift.</p>
  
  <p>I'm currently trying to grab videos stored in the photo library and display them in a collection view. After selecting a video in the collection view, I want to be able to play the video.</p>
  
  <p>Right now I've written part of the function grabVideos and I have 2 questions:</p>
  
  <ol>
  <li>How should I store these videos? Can they be stored as UIImages? A lot of the other sources I found grabbed videos from online sources and they just stored the video url</li>
  <li>What should I do in the resultHandler? I would assume thats were I store my videos into a global array</li>
  </ol>
  
  <p>Note: code below is in a function called getVideos()</p>
  
  <pre><code>    let imgManager = PHImageManager.default()
      let requestOption = PHVideoRequestOptions()
      requestOption.isSynchronous = true
      requestOption.deliveryMode = .highQualityFormat
  
      let fetchOption = PHFetchOptions()
      fetchOption.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]
  
      if let fetchResult:PHFetchResult = PHAsset.fetchAssets(with: .video, options: fetchOption) {
  
          if fetchResult.count &gt; 0 {
              for i in 0...fetchResult.count {
                  imgManager.requestAVAsset(forVideo: fetchResult.object(at: i) as! PHAsset, options: requestOption, resultHandler: {{ (&lt;#AVAsset?#&gt;, &lt;#AVAudioMix?#&gt;, &lt;#[AnyHashable : Any]?#&gt;) in
                      &lt;#code#&gt;
                      }})
              }
          } else {
              print("Error: No Videos Found")
          }
      }
  </code></pre>