The right place to call .removeObserver for NSNotificationCenter = Swift deinit()? -
I've read a lot of suggestions for the right place to call. See the Review Observe for NAS Annotation because the DDU download is not an option.
I was just thinking that the new decree (in SWIFT) would be a good option?
- nick
It really depends on the role of that class where you The NSN Station Center subscribes to the information. If you are subscribing to:
UIView
Then you should unsubscribe when the user is invisible. CPUs do not conserve resources and consume resources, while users do not see the view.
UIViewController
Here also you are performing the action in response to the notification if it is just a UI adjustment screen You should unsubscribe when the incoming controller disappears.
You are right inside the app service layer
here .removeObserver
(). However here also I inform you that when you subscribe and you subscribe to the NSNotificationCenter
notification and start and stop them from your service methods.
Comments
Post a Comment