title: UITableView delegate methods being called before viewDidLoad()
body: <p>in the <code>UIViewController</code>'s <code>viewDidLoad()</code> there is a method being called for updating a class variable. Once I navigate to another view controller and come back to this one, <code>UITableView</code>'s delegate methods are being called first where that class variable is being used. App is crashing because that variable is being constructed in <code>viewDidLoad()</code>. How can this issue be fixed? Thank you.</p>
  
  <p>the class variable in question:</p>
  
  <pre><code>var showHideDict = Dictionary&lt;Int, Bool&gt;()
  </code></pre>
  
  <p>the <code>viewDidLoad()</code>:</p>
  
  <pre><code>override func viewWillAppear() {
      super.viewWillAppear()
      makeAPICall()
  }
  </code></pre>
  
  <p>the API calling method:</p>
  
  <pre><code>func makeAPICall() {
      // create helper object
      let helper = ModelHelper()
      helper.createModels(receivedDict: result! as NSDictionary)
  
              // store the showHideDict
      for index in 0...(Modelclass.models.count - 1) {
          self.showHideDict[index] = true
      }
  
      DispatchQueue.main.async {
           self.tableView.reloadData()
      }
  }
  </code></pre>