title: Trying to Call Method From Different Swift Class
body: <p>I have two swift classes and in one, I need to refer to a method in the other swift class. Both of the respective view controllers are attached to a <code>tabBarController</code>, so I tried to create an instance like such: </p>
  
  <pre><code>let mapVC : MapVC = self.tabBarController!.viewControllers![1] as! MapVC
  mapVC.loadViewIfNeeded()
  mapVC.add(newLocation:location_one) // .add is the method I want to call
  </code></pre>
  
  <p>Where <code>MapVC</code> holds the method I wish to call. And the <code>mapView</code> is the second option on the <code>tabBar</code>, hence the index of 1. However, I get the error <code>[fatal error: unexpectedly found nil while unwrapping an Optional value]</code> when I cast the object <code>mapVC</code>. I believe the problem has something to do with creating an instance <code>mapVC</code>, and I believe I may not have set it up properly, but I am not sure how to fix it.</p>
  
  <p>I am not quite sure how to phrase my problem so if you are still confused, I can provide more information in the comments.</p>