I would like to track when each UIViewController comes to foreground. Now, I can do that in each viewDidAppear which I dont want. Because I have almost 60+ viewControllers. So looking for one place where I can put my two line of the code rather than in each viewDidAppear?
How to detect navigation to each UIViewController of the app?
The advantage of putting the code in each viewWillAppear is that you don't need to actively monitor what is happening, the code will execute when the viewController will appear. Set up an NSNotification with an object that indicates the vieewController. Than 'paste' the code into each viewWillAppear and create an observer for the notifications anywhere you want.