Where to remove observer for NSNotification in Swift?

后端 未结 9 1465
你的背包
你的背包 2020-12-01 00:37

Where should I remove the observer for NSNotification in Swift, since viewDidUnload and dealloc() are unavailable?

9条回答
  •  情深已故
    2020-12-01 01:15

    Swift provides a deinit method that is called on instances of classes before they are destroyed.

    https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Deinitialization.html

提交回复
热议问题