title: Add a loading overlay on complete screen except navigation bar - Swift
body: <p>I want to show a loading screen till the time data is fetched from server. For that I am using this code <a href="https://gist.github.com/igordeoliveirasa/78a310f0348fcad9b270" rel="nofollow noreferrer">https://gist.github.com/igordeoliveirasa/78a310f0348fcad9b270</a> to create an overlay with an activity indicator.</p>
  
  <p>But this works only if I add overlay on base <code>NavigationController</code> screen by calling </p>
  
  <pre><code>LoadingOverlay.shared.showOverlay(self.navigationController?.view)
  </code></pre>
  
  <p>With which even my navigation bar also gets covered with overlay and user have no way to go back in case it is taking longer for a page to get load. If I try to use following nothing happens.</p>
  
  <pre><code>LoadingOverlay.shared.showOverlay(self.view)
  </code></pre>
  
  <p>Any hint or solution would be greatly appreciated.</p>
  
  <p><strong>EDIT</strong> - I am trying to create something like below, where after even a loading overlay navigation bar and Tab bar would still appear and user can make any actions over them</p>
  
  <p><a href="https://i.stack.imgur.com/X9ie3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X9ie3.jpg" alt="enter image description here"></a></p>
  
  <p>But on using the code of the link I provided above, and also @Cute Angel's code, what I am getting is like below, where overlay is indeed coming but it is not coming over elements I have added in base view from auto layout if I use <code>self.view</code> </p>
  
  <p><a href="https://i.stack.imgur.com/nZoUy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nZoUy.png" alt="enter image description here"></a></p>
  
  <p>How can I get this overlay on top of all elements I have added in base view of <code>ViewController</code> and leave navigation bar and tab bar without overlay</p>
  
  <p>What I am trying to achieve is something like below</p>
  
  <p><a href="https://i.stack.imgur.com/J253h.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J253h.png" alt="enter image description here"></a></p>