0

For analytics purposes, I would like to detect whenever the top UIViewController is modified. I don't want to use inheritance, but rather delegate some event that I can use. I see that Firebase have some type of mechanism for that but I couldn't figure how exactly. Something like the following will be great:

NotificationCenter.default.addObserver(self, selector: #selector(topViewModified), name: .TopViewModified, object: nil)

Thanks.

Tomer
  • 4,382
  • 5
  • 38
  • 48
  • Use swizzling for `viewDidAppear` method where you will post notification about view controller appearing – Taras Chernyshenko Jul 08 '19 at 14:08
  • 1
    I believe as Taras mentioned, without subclassing you need to swizzle the viewDidAppear or something similar as explained here https://stackoverflow.com/questions/39562887/how-to-implement-method-swizzling-swift-3-0. – Jack Wilkinson Jul 08 '19 at 14:23

0 Answers0