title: Swift TableView data only loading after scrolling to bottom
body: <p>I have a code where I am fetching images from URLs and displaying them in a tableview, however the images only show up inside tableview when scrolling down to far bottom of the screen, as show in the image below.</p>
  <p><a href="https://i.stack.imgur.com/dxFqn.png" rel="nofollow noreferrer">TableView before scrolling to bottom, screenshot</a></p>
  <p><a href="https://i.stack.imgur.com/aTQQk.png" rel="nofollow noreferrer">TableView after scrolling to bottom, screenshot</a></p>
  <p>Code for the fetching images and tableView</p>
  <pre><code>    @IBOutlet weak var tableView: UITableView!
      let imageArray = [UIImage()]
      let urlArray = [&quot;https://media.api-sports.io/football/teams/50.png&quot;,&quot;https://media.api-sports.io/football/teams/47.png&quot;,&quot;https://media.api-sports.io/football/teams/49.png&quot;,&quot;https://media.api-sports.io/football/teams/46.png&quot;,&quot;https://media.api-sports.io/football/teams/48.png&quot;]
      
      override func viewDidLoad() {
          super.viewDidLoad()
          tableView.delegate = self
          tableView.dataSource = self
          tableView.register(UINib(nibName: &quot;ImageCell&quot;, bundle: nil), forCellReuseIdentifier: &quot;imageCell&quot;)        // Do any additional setup after loading the view.
      }
      
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: &quot;imageCell&quot;, for: indexPath) as! ImageCell
          cell.clubImage.load(url: URL(string: urlArray[indexPath.row])!)
          return cell
      }
      
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return urlArray.count
      }
  }
  
  extension UIImageView {
      func load(url: URL) {
          DispatchQueue.global().async { [weak self] in
              if let data = try? Data(contentsOf: url) {
                  if let image = UIImage(data: data) {
                      DispatchQueue.main.async {
                          self?.image = image
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  <p>How can I show the images as soon as the app loads?</p>
  <p>Thanks</p>