Advertisement
Guest User

Untitled

a guest
May 24th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. // MARK: - Init
  2.  
  3. deinit {
  4. NotificationCenter.default.removeObserver(self)
  5. }
  6.  
  7. // MARK: - View Life Cycle
  8.  
  9. override func viewDidLoad() {
  10. super.viewDidLoad()
  11. addObservers()
  12. }
  13.  
  14. // MARK: - Add Observers
  15.  
  16. private func addObservers() {
  17. NotificationCenter.default.addObserver(
  18. forName: .SomethingToObserveNotification,
  19. object: nil,
  20. queue: .main,
  21. completion: handleNotification
  22. )
  23. }
  24.  
  25. private func handleNotification(_ notification: Notification) {
  26. // No-op but there is a leak in this controller!
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement