I am trying to create Singleton that it would be initialised from AppDelegate. The purpose is to monitor all the UIViewControllers
(the active one) and print on console the kind of class (as proof of concept). So my basic idea is to initialise the singleton in AppDelegate
and pass as parameter a reference of AppDelegate
. Then somehow I must monitor which one is the active view.
For example: View A B C A is the first view in Navigation Controller. My Singleton knows that the current view is A. Then we push view B and Singleton is notified that view B is now the current view. Same with C. Now we pop C and Singleton knows that the current view is B.
Is any kind KVO or NSNotification for notifying my singleton that a new UIView
is appeard/removed? Any alternatives for this problem?