title: how to load images fast during scrolling in swift 3?
body: <p>I had implemented a set of images from url and displaying it on collection view and table view and deployed in the iphone 5 device after loading app the images page was not scrolling fast and taking more time delay how to avoid this can anyone help me ? </p>
  
  <pre><code>func numberOfSections(in tableView: UITableView) -&gt; Int {
      return 1
  }
  
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return imageArray.count
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "productsCell", for: indexPath) as! productsCell
      let arr = imageArray[indexPath.row]
      let urls = NSURL(string: arr)
      let data = NSData (contentsOf: urls! as URL) //make sure your image in this url does exist, otherwise unwrap in a if let check
      cell.productImage.image = UIImage(data: data! as Data)
      cell.productName.lineBreakMode = NSLineBreakMode.byWordWrapping
      cell.productName.numberOfLines = 2
      cell.productName.text = self.productName[indexPath.row]
      cell.productPrice.text = self.productprice[indexPath.row]
      cell.buynowButton .addTarget(self, action: #selector(buyNowButton(_:)), for:UIControlEvents.touchUpInside)
      cell.cartButton .addTarget(self, action: #selector(cartButton(_:)), for:UIControlEvents.touchUpInside)
      return cell
  }
  </code></pre>