title: Find the top view in iOS
body: <p>I want to create a loading view page to put on top of all the views in screen. I use the following code to get the rootViewController's view:</p>
  
  <pre><code>UIApplication.sharedApplication.keyWindow.rootViewController.view
  </code></pre>
  
  <p>I create my view page and add it as a subview to rootViewController's view. My problem is when I do this, if the rootViewController changes, my loading page will go behind the new viewController's view. For example, I am calling the showLoading function when I send an http request. When response comes back, it changes the viewController and loading goes behind it. Is there any way to put my loading on top independent from what happens in the background?</p>