title: iOS Swift how to monitor UIViewController lifecyle
body: <p>I am new to iOS development. So pardon me if this is a very basic thing.</p>
  <p>From what I have learnt till now:</p>
  <p><code>UIViewController</code> class resembles somewhat equivalent to an <code>Activity</code> class in Android.</p>
  <p>and <code>viewDidLoad/viewWillAppear</code> method to <code>onCreate/onStart</code> method</p>
  <p>and <code>viewDidAppear</code> method to <code>onResume</code> method</p>
  <p>Please correct me if I am wrong here.</p>
  <p>Now, in <code>Android</code> we can monitor which of these methods(including other lifecycle methods) are triggered/called by implementing an <code>Interface</code> (<code>ActivityLifecycleCallbacks</code>) (somewhat resembling a protocol in iOS) which exists in the <code>Application</code> class in any Activity (particularly in a class which extends Application class).</p>
  <p>It means that now these methods will be triggered/called whenever there is any navigation from one screen to another in the android app.</p>
  <p>How do I do this in iOS using Swift? How do I know which screen(UIViewcontroller) the user is currently in and where he is navigating?</p>
  <p>In short I want to write a standalone class which logs which screen(UIViewController) the user is currently in and which one of the lifecycle methods(viewDidLoad, viewWillAppear etc) is being executed?</p>
  <p>Someone please help me out.</p>
  <p>Edit:- I don't want them to subclass my standalone class instead of UIViewController class.</p>