I added a variable of Timer to my class, and used its didSet observer to invalidate old value
var timer: Timer? {
didSet { oldValue?.invalidate() }
}
deinit {
timer = nil
}
I thought this would be enough to invalidate timer when class is deinitialized, but looks like didSet is not called. Why is that? Are observers not working during deinitialization?