I am creating and attempting to use an NSTimer with the following code:
import Foundation
class TimerCallbacker {
init() {
NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: #selector(TimerCallbacker.timerDidFire(_:)), userInfo: nil, repeats: true)
}
@objc func timerDidFire(timer: NSTimer) {
print("hi")
}
}
let timerCallbacker = TimerCallbacker()
The program runs for a second without any console output and then ends, instead of the expected functionality of printing "hi" every second.