title: Pausing timer when app is in background state Swift
body: <p>My ViewController.swift</p>
  
  <pre><code>func startTimer() {
      timer = NSTimer().scheduleTimerWithTimerInvterval(1.0,target: self,selctor: Selector("couting"),userinfo: nil, repeats: true)
  }
  
  func pauseTimer() {
      timer.invalidate()
      println("pausing timer")
  }
  </code></pre>
  
  <p>and this is appDelegate.swift</p>
  
  <pre><code>func applicateWillResignActive(application: UIApplication) {
      viewController().pauseTimer()
      println("closing app")
  }
  </code></pre>
  
  <p>It is printing <strong>pausing timer and closing app</strong> but when I open again I see it never paused. How do I do it correctly?</p>