After using NSTimer, the class deinit method is never called. The class is written in Swift, and I call the timer at the "init" like so:
init(eventsDistributor : EventsDistributor, orderSide : ORDER_SIDE, stockViewModel : StockViewModel, orderType : ORDER_TYPE_ENUM, orderPrice : NSNumber) {
self.eventsDistributor = eventsDistributor
self.orderSide = orderSide
self.stockViewModel = stockViewModel
self.orderType = orderType
self.orderPrice = orderPrice
super.init()
_events()
loadPreOrderDetails()
//Here I call the Timer:
var reloadTimer = NSTimer.scheduledTimerWithTimeInterval(10.0, target: self, selector: "loadSecurityTradeInfo", userInfo: nil, repeats: true)
reloadTimer.fire()
}
I tried using the NSTimer
as a local variable too, and no success there...
Anyone facing this issue? Is there a timer I can use in Swift which will not causes the class not to be dealloced? Thanks