title: How do I reload UITableView data when the app comes to foreground? (Xcode 8.3 / Swift 3)
body: <p>I have the following methods in my "ViewController" class to populate custom cells in a UITableView from a GET API call. This works fine when app first loads.</p>
  
  <pre><code>//ViewController    
  override func viewDidAppear(_ animated: Bool) {
      super.viewDidAppear(animated)
      loadDataInUITableViewCell()
  }
  
  func loadDataInUITableViewCell() {
          apiCentral.sharedInstance.fetchData() {
          result in
          guard result.error == nil else {
              self.handleError(result.error!)
              return
          }
          if let fetchedData = result.value {
              self.data = fetchedData
          }
          self.messagesTableView.reloadData()
      }
  }
  </code></pre>
  
  <p>How do I refresh the data when the app comes to the foreground? Well, I added the following to AppDelegate to run the "loadDataInUITableViewCell" method so that the data reloads.</p>
  
  <pre><code>//AppDelegate
  let mainViewController = ViewController()
  
  func applicationWillEnterForeground(_ application: UIApplication) {
      mainViewController.loadDataInUITableViewCell()
  }
  </code></pre>
  
  <p>ISSUE: The above mechanism works fine however, I get the following error when the app comes to the foreground.</p>
  
  <p>"fatal error: unexpectedly found nil while unwrapping an Optional value"</p>
  
  <p>The issue seems to be happening at "self.messagesTableView.reloadData()" line of code. I'm using Xcode 8.3 and coding in Swift 3. Any guidance would be appreciated. Thank you.</p>