title: UITableView not working when adding JSON data
body: <p>I'm trying to get a table view to load with some JSON data that I get from imgur. I can make a request to my backend that goes and gets the imgur data, spits it back out to me, and then I can populate the table. However, I get this really weird problem where the data is cutoff at the end. <a href="https://imgur.com/a/VMTCo" rel="nofollow noreferrer">Here</a> is a picture. If I try and do another search it doesn't load any more data into the table, so clearly I break it when I am doing this. I don't really know what I'm doing wrong. I'm also trying to get this to be clickable with modals at some point, and dequeuing the reusable cell is probably not right either, but I guess I'll get there after this problem. </p>
  
  <p>Anyway, any help would be appreciated.</p>
  
  <pre><code>class ViewController3: UIViewController, UITextFieldDelegate,UITableViewDataSource {
  
      var dataState: Data?
  
      var linkArray = [String]()
      var titleArray = [String]()
  
      @IBOutlet weak var tableView: UITableView!
  
      @IBOutlet weak var SearchTextField: UITextField!
  
      @IBAction func SearchButton(_ sender: Any) {
  
          let urlString = "http://localhost:3000/getimages"
  
  
          Alamofire.request(urlString, method: .post, parameters: ["search": SearchTextField.text!],encoding: JSONEncoding.default, headers: nil).responseJSON {
              response in
              switch response.result {
              case .success:
                  let json = JSON(response.data!)
  
  
                  for (_, subJson) in json["data"] {
                      if let link = subJson["link"].string {
                         self.linkArray.append(link)
                      }
                      if let title = subJson["title"].string{
                          self.titleArray.append(title)
                      }
                  }
                  print("this is linkArray ", self.linkArray)
                  print("this is titleArray ", self.titleArray)
                  self.dataUpdated()
                  break
              case .failure(let error):
                  print(error)
              }
          }
  
  
      }
  
  
      @IBAction func BackToTabControl(_ sender: Any) {
          let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
  
          let tabBarVC = storyBoard.instantiateViewController(withIdentifier: "tabBarController") as! UITabBarController
  
          if let vc1 = tabBarVC.viewControllers?.first as? ViewController1 {
              vc1.dataState = dataState
          }
  
          let appDelegate = UIApplication.shared.delegate as! AppDelegate
          appDelegate.window?.rootViewController = tabBarVC
      }
  
      func textFieldShouldReturn(_ textField: UITextField) -&gt; Bool {
          textField.resignFirstResponder()
          return true
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
          self.tableView.bounces = true
          SearchTextField.returnKeyType = UIReturnKeyType.done
          SearchTextField.delegate = self
          tableView.dataSource = self
  
      }
  
      func numberOfSections(in tableView: UITableView) -&gt; Int {
          return 1
      }
  
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return titleArray.count
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "cellReuseIdentifier")! //1.
  
          let text = titleArray[indexPath.row] //2.
  
          cell.textLabel?.text = text //3.
  
          return cell //4.
      }
  
      func dataUpdated() {
          DispatchQueue.main.async {
              self.tableView.reloadData()
          }
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
      }
  
  }
  </code></pre>