title: IOS Swift how can I reload a tableView from a different controller
body: <p>I have 2 controllers A and Controller B . Controller A has a TableView and Controller B is a subview that when clicked opens a form and on Submit it enters data into the database. My problem is that I attempt to reload my TableView from Controller B from the user hits submit and I get the following error
  <strong>fatal error: unexpectedly found nil while unwrapping an Optional value</strong> from this line</p>
  
  <pre><code> self.TableSource.reloadData()
  </code></pre>
  
  <p>Now the data from Controller B is successfully inserted so after I restart my app the data I submit is there . This is my code (TableSource is the TableView outlet)</p>
  
  <p><strong>Controller A</strong></p>
  
  <pre><code>  func reloadTable(latmin: Float,latmax: Float,lonmin: Float, lonmax: Float) {
          let url:URL = URL(string:ConnectionString+"MY-URL")!
  
  
  
          let session = URLSession.shared
          var request = URLRequest(url: url)
          request.httpMethod = "POST"
          request.cachePolicy = NSURLRequest.CachePolicy.reloadIgnoringCacheData
          let parameter = "parameters"
          request.httpBody = parameter.data(using: String.Encoding.utf8)
          session.dataTask(with:request, completionHandler: {(data, response, error) in
              if error != nil {
  
              } else {
                  do {
  
                      let parsed = try JSONSerialization.jsonObject(with: data!, options: .allowFragments) as! [String:Any]
  
  
  
                      if let S = parsedData["myData"] as? [AnyObject]            {
  
  
                          for A in Data {
                             // gets Json Data
  
                                         }
  
                          DispatchQueue.main.async {
                      // This is what I named my TableView
                              self.TableSource.reloadData()
  
                          }
                      }
  
                  } catch let error as NSError {
                      print(error)
                  }
  
              }
  
          }).resume()
  
  
      }
  </code></pre>
  
  <p>That is my HTTP-Request that gets data from the database, now in that same Controller A I have a button that when clicked opens the SubView to Controller B and this is the code</p>
  
  <pre><code>  @IBAction func Post_Action(_ sender: Any) {
          let Popup = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ControllerB") as! Controller B
  
          self.addChildViewController(Popup)
          Popup.view.frame = self.view.frame
          self.view.addSubview(Popup.view)
          Popup.didMove(toParentViewController: self)
      }
  </code></pre>
  
  <p>This is the code in <strong>Controller B</strong> and this is how I try to reload the TableView in Controller A</p>
  
  <pre><code>@IBAction func Submit_Form(_ sender: Any) {
  
    // Code that submits the form no issues here
  
  
          latmin = 32.18
         latmax = 32.50
         lonmin = -81.12
         lonmax = -81.90
  
       let Homepage = ControllerA()
         Homepage.reloadTable(latmin: latmin!,latmax: latmax!,lonmin: lonmin!,lonmax: lonmax!)
  
      }
  </code></pre>
  
  <p>So as stated before Controller A loads the data from the Database, Controller B has a form and when submitted it enters new data into the database . That whole process works I just now want to update the TableView in Controller A from the form is submitted in Controller B</p>