I am adding a number of observers in my viewController -- applicationWillResignActive, applicationDidEnterBackground, and many others. I w
viewController
applicationWillResignActive
applicationDidEnterBackground
@Sh_Khan is right:
NotificationCenter.default.removeObserver(self)
You can get even further, as mentioned in the Apple Documentation:
If your app targets iOS 9.0 and later or macOS 10.11 and later, you don't need to unregister an observer in its dealloc method.