I'm using the following NSTimer class method:
NSTimer.scheduledTimerWithTimeInterval(
3,
target: self,
selector: Selector("setWaitThreeSecondsFalse"),
userInfo: nil,
repeats: false
)
does the returned timer get deallocated after the selector runs? or do I have to explicitly invalidate the timer?
A non-repeating timer like you have will invalidate itself once it fires. So you do not need to do anything in this case unless you wish to invalidate it before it fires.
From the docs for NSTimer
:
Once scheduled on a run loop, the timer fires at the specified interval until it is invalidated. A non-repeating timer invalidates itself immediately after it fires.
As long as you don't have a strong reference to the timer, it will be deallocated after it is invalidated.