How to call method from another class in swift
<p>I have a viewcontroller class <code>ViewController</code> with collectionView. Also I have singleton class <code>FacebookManager</code> for fetching data from facebook.</p>

<p>What I want to do is to run a method in facebook class and then call a method in ViewController to reload collectionView.</p>

<p>I tried to make a reference to ViewController in Facebook manager by setting</p>

<pre><code>class FacebookManager  {
   static let sharedInstance = FacebookManager()
   var vc:ViewController?
}
</code></pre>

<p>Then setting in ViewController </p>

<pre><code>class ViewController: {
   func viewDidLoad() {
      FacebookManager.sharedInstance.vc = self
   }
}
</code></pre>

<p>And then calling in FacebookManager</p>

<pre><code>func myMethod() {
   vc.collectionView.reloadData()
}
</code></pre>

<p>But this doesn't work.</p>

<p>How to do this properly?</p>