How to set target in Swift (to call a class level function) the way it is done in obj-c:
call a class level method in scheduledTimerWithTimeInterval
class MyClass: NSObject{
class func startTimer(){
NSTimer.scheduledTimerWithTimeInterval(2.0, target: MyClass.self, selector: "callByTimer:", userInfo: nil, repeats: true)
}
class func callByTimer(timer: NSTimer!){
println("Called")
}
}
MyClass.startTimer()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With