title: Swift - ReloadData doesn't call CellForRowatIndexPath
body: <p>I'm kind of a swift noobie trying to load my JSON data from my server into my UITableView, but when I call the ReloadData method nothing seems to happen (while it should be calling CellForRowatIndexPath as far as I know). I've tried some solutions that I found (like putting it in the main thread), but those didn't do the trick. So I wonder if anyone could help me with this, because I don't know what to do.</p>
  
  <p>Thanks in advance.</p>
  
  <p>This is my code:</p>
  
  <pre><code>import UIKit
  import Alamofire
  
  private let reuseIdentifier = "PresenceCell"
  
  class PresenceController: UITableViewController {
  
      @IBOutlet var presenceTableView: UITableView!
      var presenceList = [] as [Presence]
  
      override func viewDidLoad() {
          super.viewDidLoad()
          navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Add", style: .plain, target: self, action: #selector(addPresence))
          loadPresences(date: NSDate() as Date)
  
  
          // Uncomment the following line to preserve selection between presentations
          // self.clearsSelectionOnViewWillAppear = false
  
          // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
          // self.navigationItem.rightBarButtonItem = self.editButtonItem()
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
      // MARK: - Table view data source
  
      override func numberOfSections(in tableView: UITableView) -&gt; Int {
          return 1
      }
  
      func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return presenceList.count
      }
  
      override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath) as! PresenceCell
          let presence = presenceList[indexPath.row]
          cell.lblPresenceName.text = presence.name
          cell.lblPresenceTimes.text = presence.times
          if (presence.reasons.characters.contains("S")) {
              cell.lblPresenceSTD.isHidden = true
          } else {
              cell.lblPresenceSTD.isHidden = false
          }
          if (presence.reasons.characters.contains("M")) {
              cell.lblPresenceMDN.isHidden = true
          } else {
              cell.lblPresenceMDN.isHidden = false
          }
          if (presence.reasons.characters.contains("C")) {
              cell.lblPresenceEDH.isHidden = true
          } else {
              cell.lblPresenceEDH.isHidden = false
          }
          if (presence.reasons.characters.contains("L")) {
              cell.lblPresenceLEA.isHidden = true
          } else {
              cell.lblPresenceLEA.isHidden = false
          }
          if (presence.reasons.characters.contains("T")) {
              cell.lblPresenceTRD.isHidden = true
          } else {
              cell.lblPresenceTRD.isHidden = false
          }
          if (presence.event) {
              cell.swPresenceEvent.isOn = true
          } else {
              cell.swPresenceEvent.isOn = false
          }
          return cell
      }
  
      func addPresence(){
          performSegue(withIdentifier: "addPresenceSegue", sender: self)
      }
  
      private func loadPresences(date: Date) {
          let dateFormat = DateFormatter()
          dateFormat.dateFormat = "dd-MM-yyyy"
          let dateString = dateFormat.string(from: date)
          let url = "MyUrl" + dateString
          Alamofire.request(url, method: .get, encoding: URLEncoding.httpBody).responseJSON{ response in
              if let json = response.result.value {
                  let dictionary = json as! [String:Any]
                  let presences = dictionary["presences"] as! NSArray
                  for index in 0..&lt;presences.count {
                      let jsonPresence = presences[index] as! [String:Any]
                      let presence = Presence(id: jsonPresence["id"] as! Int, name: jsonPresence["name"] as! String, times: (jsonPresence["starttime"] as! String) + " - " + (jsonPresence["endtime"] as! String), reasons: jsonPresence["reasons"] as! String, event: ((jsonPresence["event"] as! Int) == 1))
                      //add your data into tables array from textField
                      self.presenceList.append(presence)
                  }
                  DispatchQueue.main.async{
                      self.tableView.reloadData()
                  }
              }
          }
      }
  }
  </code></pre>