title: Loading pictures in a huge UICollectionView
body: <p>I'm downloading pictures for my collection view cells in the following way:</p>
  
  <pre><code>func loadThumbnail(..){
  
                ...
              //Making the request
              self.ProfilePicture.sd_setImage(with: requestUrl, placeholderImage: #imageLiteral(resourceName: "SharePreviewIcon"), completed: { [weak self] (newImage, error, cacheType, url) in
  
                  if self == nil {
                      return
                  }
  
                  if !isActive(){ //If the cell is not active, ignore and return
                      return
                  }
  
                  return
              })
  
  }
  </code></pre>
  
  <p>and I call loadThumbnail everytime the cell is active. Now if I have 30 cells, and 15 are active, then all 15 pictures will be loaded, and a lot of requests are being canceled or simply closed by the system because they are too many at once.</p>
  
  <p>I'm still an amateur, and I just don't know what to do.
  Thanks a lot.</p>
  
  <p><strong>IMPORTANT EDIT*</strong></p>
  
  <p>Everything lives in a Tab Controller and every tab has it's own collection view. If I cancel the download in the prepareForUse() method, then only those cells who are recycled are going to be canceled. </p>
  
  <p>If I switch tabs, the cells that are still active, won't get canceled, and I can't load the cells from the new collection view.</p>