Skip to content

Instantly share code, notes, and snippets.

@chauvincent
Last active May 14, 2019 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chauvincent/33cf83b0894d9bb12d38166c15dd84a5 to your computer and use it in GitHub Desktop.
Save chauvincent/33cf83b0894d9bb12d38166c15dd84a5 to your computer and use it in GitHub Desktop.
// MARK: - Init
deinit {
NotificationCenter.default.removeObserver(self)
}
// MARK: - View Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
addObservers()
}
// MARK: - Add Observers
private func addObservers() {
NotificationCenter.default.addObserver(
forName: .SomethingToObserveNotification,
object: nil,
queue: .main,
completion: handleNotification
)
}
private func handleNotification(_ notification: Notification) {
// No-op but there is a leak in this controller!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment