I have a Swift class that I\'d like to look something like this:
class UpdateManager {
let timer: NSTimer
init() {
timer = NSTimer(timeInterval: 600
It's possible that Swift 2 has changed what works. I'm using code like the following:
@objc class Test : NSObject {
var timer : NSTimer!
init text() {
super.init()
timer = NSTimer(timeInterval: 1.0, target: self, selector: "timerFired:", userInfo: nil, repeats: true)
NSRunLoop.mainRunLoop().addTimer(timer, forMode: NSRunLoopCommonModes)
}
}
Needed both @objc declaration and NSObject subclass. Also timer needs to be a var, not let.