title: back to initial view controller
body: <p>As you can see i have an initial view controller with label in it <strong>"Initial ViewController"</strong>. In this view controller i use below code to go to selected tab of <strong>Tab Bar Controller</strong></p>
  
  <pre><code>let vc1 = sb.instantiateViewController(withIdentifier: "tabbar") as! UITabBarController
  vc1.selectedIndex = selected
  let controllers = [vc1]
  navigationController!.setViewControllers(controllers, animated: true)
  </code></pre>
  
  <p>In my First View, there's a button <strong>"Present VC"</strong> which presents <strong>"Presented View"</strong>. </p>
  
  <pre><code>let vc1 = sb.instantiateViewController(withIdentifier: "PresentedVC") as! PresentedVC
  present(vc1, animated: true, completion: nil)
  </code></pre>
  
  <p>Now i want to go back from presented vc to root vc(Initial View Controller). I can do this with:</p>
  
  <pre><code>let viewController = self.storyboard?.instantiateViewController(withIdentifier: "FirstNavigationController") as! FirstNavigationController
  UIApplication.shared.keyWindow?.rootViewController = viewController 
  </code></pre>
  
  <p>but this instantiate Initial View Controller every time and views remain in memory. How can i go back to Initial View Controller without instantiating it?</p>
  
  <p><strong>PS:</strong> FirstNavigationController is initial Navigation Controller.</p>
  
  <p><a href="https://i.stack.imgur.com/yzxvf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yzxvf.png" alt="enter image description here"></a></p>