title: Is it okay to change a key window?
body: <p>I create a <code>UIWindow</code> and make it key and visible in <code>didFinishLaunching</code> and later create another <code>UIWindow</code> and also make it key and visible. I expect the first window to be abandoned and released from the memory and the second – to be shown. But as I see in the debugger (<strong>Debug View Hierarchy</strong>), they both are in the hierarchy.</p>
  
  <p>Is it normal?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The question is not why both objects are in the memory. I'd like to know why both of them are in the view hierarchy? And how can I remove one of them from there?</p>
  
  <p><em>Note: Key windows don't have superviews, so I can't do that by simply calling <code>removeFromSuperview</code>.</em></p>
  
  <p><a href="https://i.stack.imgur.com/ys38Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ys38Q.png" alt="enter image description here"></a></p>