I have a class Person which is instantiated multiple times.Each person get's their own timer. Upon in my init
for Person
I call startTimer()
.
class Person {
var timer = NSTimer()
func startTimer() {
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("timerTick"), userInfo: nil, repeats: true)
}
func timerTick() {
angerLevel++
println("Angry! \(angerLevel)")
}
...
...
}
So I may have 3 instances of Person in an array of Person[]
. I am getting an error:
2014-06-25 13:57:14.956 ThisProgram[3842:148856] *** NSForwarding: warning: object 0x113760048 of class '_TtC11ThisProgram6Person' does not implement methodSignatureForSelector: -- trouble ahead
I read elsewhere that I should inherit from NSObject
but this is in Swift not Obj-C. The function is within the class so I am not sure what to do.
class Person : NSObject { ... }
. Are you looking for a different solution? – Merimerida