var sessionTimer: NSTimer? ... sessionTimer = NSTimer.scheduledTimerWithTimeInterval(0.5, target: self, selector: #selector(SessionEditorViewController.lubDub(_:)), userInfo: nil, repeats: true) ... func lubDub(timer: NSTimer) { let elapsedTime = NSDate().timeIntervalSince1970 - startTime print("(elapsedTime)") } ... // clean up when done sessionTimer?.invalidate() sessionTimer = nil