title: Swift Json Tableview laggy
body: <p>I have a problem. I have this code in Swift but when i scrolling in the tableview its very laggy and i dont know what the problem is..??
  Its downloading image data that is like 20mb each (i think)..</p>
  
  <p>Thanks!</p>
  
  <pre><code>func downloadJsonWithTask() {
  
      let url = NSURL(string: urlString)
  
      var downloadTask = URLRequest(url: (url as? URL)!, cachePolicy: URLRequest.CachePolicy.reloadIgnoringCacheData, timeoutInterval: 200)
  
      downloadTask.httpMethod = "GET"
  
      URLSession.shared.dataTask(with: downloadTask, completionHandler: {(data, response, error) -&gt; Void in
  
          let jsonData = try? JSONSerialization.jsonObject(with: data!, options: .allowFragments)
  
          print(jsonData)
  
      }).resume()
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! TableViewCell
      cell.nameLabel.text = nameArray[indexPath.row]
      cell.dobLabel.text = dobArray[indexPath.row]
  
      let imgURL = NSURL(string: imgURLArray[indexPath.row])
  
      if imgURL != nil {
          let data = NSData(contentsOf: (imgURL as? URL)!)
          cell.imgView.image = UIImage(data: data as! Data)
      }
  
      return cell
  }
  
  ///for showing next detailed screen with the downloaded info
  func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  
      let vc = self.storyboard?.instantiateViewController(withIdentifier: "DetailViewController") as! DetailViewController
      vc.imageString = imgURLArray[indexPath.row]
      vc.imageString2 = imgURL2Array[indexPath.row]
      vc.imageString3 = imgURL3Array[indexPath.row]
      vc.imageString4 = imgURL4Array[indexPath.row]
      vc.imageString5 = imgURL5Array[indexPath.row]
      vc.imageString6 = imgURL6Array[indexPath.row]
      vc.nameString = nameArray[indexPath.row]
      vc.dobString = dobArray[indexPath.row]
      vc.txtString = txtArray[indexPath.row]
      vc.contactString = contactArray[indexPath.row]
  
      self.navigationController?.pushViewController(vc, animated: true)
  }
  </code></pre>