Wednesday, January 13, 2016

Which is the proper method to remove notification observer or close Database connection?

Earlier we was calling 'ViewDidUnload' method for this kind of purpose.

But now it is not possible.
According to Swift Book there is deinit block.
Which is going to call immediately before a class instance is deallocated.

Remember here, deinit is not method.


e.g.
deinit {
        NSNotificationCenter.defaultCenter().removeObserver(self)
    }

No comments:

Post a Comment