Stop NSTimer and dismiss view controller (swift)
<p>I am using <code>NSTimer</code> to look for updates in my <code>firebase</code> database. I have put the code inside my <code>viewDidLoad()</code>.</p>

<pre><code>NSTimer.scheduledTimerWithTimeInterval(5.0, target: self, selector: #selector(DriversInterfaceViewController.CheckFormularChild), userInfo: nil, repeats: true)
</code></pre>

<p>When the user has received a file in the database I want the user to goto another <code>ViewController</code>. The problem is that either the old <code>ViewController</code> is running in the background or the timer does not stop when changing <code>View Controller</code>.</p>

<pre><code>let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)            
let nextViewController = storyBoard.instantiateViewControllerWithIdentifier("recievedMission") as! RecievedMissionViewController
self.navigationController!.pushViewController(nextViewController, animated: true)
</code></pre>

<p>How do I dismiss the old <code>View Controller</code> or how do I stop the <code>NSTimer</code> <code>programmatically</code>? Thanks!</p>