I\'m activating a function in my custom cell class from a viewController. The custom cell class looks like this:
import UIKit
class TableViewCell: UITableViewCe
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let cell = tableView.cellForRowAtIndexPath(indexPath) as TableViewCell
cell.timerStarted()
}
For your tableview cell class:
func timerStarted(){
var timer = NSTimer()
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: "update", userInfo: nil, repeats: true)
}
func update(){
counter = counter - 1
println(counter)
}